+ /**
+ * Creates a single string from an associative array
+ *
+ * @param $headers array Associative Array: keys are header field names,
+ * values are ... values.
+ * @param $endl String: The end of line character. Defaults to "\n"
+ * @return String
+ */
+ static function arrayToHeaderString( $headers, $endl = "\n" ) {
+ $strings = array();
+ foreach( $headers as $name => $value ) {
+ $strings[] = "$name: $value";
+ }
+ return implode( $endl, $strings );
+ }
+
+ /**
+ * Create a value suitable for the MessageId Header
+ *
+ * @return String
+ */
+ static function makeMsgId() {
+ global $wgSMTP, $wgServer;
+
+ $msgid = uniqid( wfWikiID() . ".", true ); /* true required for cygwin */
+ if ( is_array($wgSMTP) && isset($wgSMTP['IDHost']) && $wgSMTP['IDHost'] ) {
+ $domain = $wgSMTP['IDHost'];
+ } else {
+ $url = wfParseUrl($wgServer);
+ $domain = $url['host'];
+ }
+ return "<$msgid@$domain>";
+ }
+