follow up r93397 — missed msgid
authorMark A. Hershberger <mah@users.mediawiki.org>
Thu, 28 Jul 2011 19:38:28 +0000 (19:38 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Thu, 28 Jul 2011 19:38:28 +0000 (19:38 +0000)
includes/UserMailer.php

index 1009337..1584716 100644 (file)
@@ -121,6 +121,18 @@ class UserMailer {
                return implode( $endl, $string );
        }
 
+       /**
+        * Create a value suitable for the MessageId Header
+        *
+        * @return String
+        */
+       static function makeMsgId() {
+               global $wgServer;
+
+               $msgid = uniqid( "UserMailer", true ); /* true required for cygwin */
+               return "<$msgid@$wgServer>";
+       }
+
        /**
         * This function will perform a direct (authenticated) login to
         * a SMTP Server to use for mail relaying if 'wgSMTP' specifies an
@@ -175,8 +187,8 @@ class UserMailer {
                $headers['Content-type'] = ( is_null( $contentType ) ?
                        'text/plain; charset=UTF-8' : $contentType );
                $headers['Content-transfer-encoding'] = '8bit';
-               // @todo FIXME
-               $headers['Message-ID'] = "<$msgid@" . $wgSMTP['IDHost'] . '>';
+
+               $headers['Message-ID'] = self::makeMsgId();
                $headers['X-Mailer'] = 'MediaWiki mailer';
                $headers['From'] = $from->toString();
 
@@ -198,11 +210,6 @@ class UserMailer {
                        }
                        require_once( 'Mail.php' );
 
-                       $msgid = str_replace( " ", "_", microtime() );
-                       if ( function_exists( 'posix_getpid' ) ) {
-                               $msgid .= '.' . posix_getpid();
-                       }
-
                        wfSuppressWarnings();
 
                        // Create the mail object using the Mail::factory method