Skip to content

Instantly share code, notes, and snippets.

@Robbert
Created February 16, 2013 17:51
Show Gist options
  • Save Robbert/4967898 to your computer and use it in GitHub Desktop.
Save Robbert/4967898 to your computer and use it in GitHub Desktop.

Revisions

  1. Robbert created this gist Feb 16, 2013.
    14 changes: 14 additions & 0 deletions message-id.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php

    /**
    * @see http://www.jwz.org/doc/mid.html
    */
    function generateMessageID()
    {
    return sprintf(
    "<%s.%s@%s>",
    base_convert(microtime(), 10, 36),
    base_convert(bin2hex(openssl_random_pseudo_bytes(8)), 16, 36),
    $_SERVER['SERVER_NAME']
    );
    }