]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - includes/UserMailer.php
MediaWiki 1.16.4
[autoinstalls/mediawiki.git] / includes / UserMailer.php
1 <?php
2 /**
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16  * http://www.gnu.org/copyleft/gpl.html
17  *
18  * @author <brion@pobox.com>
19  * @author <mail@tgries.de>
20  * @author Tim Starling
21  *
22  */
23
24
25 /**
26  * Stores a single person's name and email address.
27  * These are passed in via the constructor, and will be returned in SMTP
28  * header format when requested.
29  */
30 class MailAddress {
31         /**
32          * @param $address Mixed: string with an email address, or a User object
33          * @param $name String: human-readable name if a string address is given
34          */
35         function __construct( $address, $name = null, $realName = null ) {
36                 if( is_object( $address ) && $address instanceof User ) {
37                         $this->address = $address->getEmail();
38                         $this->name = $address->getName();
39                         $this->realName = $address->getRealName();
40                 } else {
41                         $this->address = strval( $address );
42                         $this->name = strval( $name );
43                         $this->realName = strval( $realName );
44                 }
45         }
46
47         /**
48          * Return formatted and quoted address to insert into SMTP headers
49          * @return string
50          */
51         function toString() {
52                 # PHP's mail() implementation under Windows is somewhat shite, and
53                 # can't handle "Joe Bloggs <joe@bloggs.com>" format email addresses,
54                 # so don't bother generating them
55                 if( $this->name != '' && !wfIsWindows() ) {
56                         global $wgEnotifUseRealName;
57                         $name = ( $wgEnotifUseRealName && $this->realName ) ? $this->realName : $this->name;
58                         $quoted = wfQuotedPrintable( $name );
59                         if( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) {
60                                 $quoted = '"' . $quoted . '"';
61                         }
62                         return "$quoted <{$this->address}>";
63                 } else {
64                         return $this->address;
65                 }
66         }
67
68         function __toString() {
69                 return $this->toString();
70         }
71 }
72
73
74 /**
75  * Collection of static functions for sending mail
76  */
77 class UserMailer {
78         /**
79          * Send mail using a PEAR mailer
80          */
81         protected static function sendWithPear($mailer, $dest, $headers, $body)
82         {
83                 $mailResult = $mailer->send($dest, $headers, $body);
84
85                 # Based on the result return an error string,
86                 if( PEAR::isError( $mailResult ) ) {
87                         wfDebug( "PEAR::Mail failed: " . $mailResult->getMessage() . "\n" );
88                         return new WikiError( $mailResult->getMessage() );
89                 } else {
90                         return true;
91                 }
92         }
93
94         /**
95          * This function will perform a direct (authenticated) login to
96          * a SMTP Server to use for mail relaying if 'wgSMTP' specifies an
97          * array of parameters. It requires PEAR:Mail to do that.
98          * Otherwise it just uses the standard PHP 'mail' function.
99          *
100          * @param $to MailAddress: recipient's email
101          * @param $from MailAddress: sender's email
102          * @param $subject String: email's subject.
103          * @param $body String: email's text.
104          * @param $replyto MailAddress: optional reply-to email (default: null).
105          * @param $contentType String: optional custom Content-Type
106          * @return mixed True on success, a WikiError object on failure.
107          */
108         static function send( $to, $from, $subject, $body, $replyto=null, $contentType=null ) {
109                 global $wgSMTP, $wgOutputEncoding, $wgErrorString, $wgEnotifImpersonal;
110                 global $wgEnotifMaxRecips;
111
112                 if ( is_array( $to ) ) {
113                         wfDebug( __METHOD__.': sending mail to ' . implode( ',', $to ) . "\n" );
114                 } else {
115                         wfDebug( __METHOD__.': sending mail to ' . implode( ',', array( $to->toString() ) ) . "\n" );
116                 }
117
118                 if (is_array( $wgSMTP )) {
119                         require_once( 'Mail.php' );
120
121                         $msgid = str_replace(" ", "_", microtime());
122                         if (function_exists('posix_getpid'))
123                                 $msgid .= '.' . posix_getpid();
124
125                         if (is_array($to)) {
126                                 $dest = array();
127                                 foreach ($to as $u)
128                                         $dest[] = $u->address;
129                         } else
130                                 $dest = $to->address;
131
132                         $headers['From'] = $from->toString();
133
134                         if ($wgEnotifImpersonal) {
135                                 $headers['To'] = 'undisclosed-recipients:;';
136                         }
137                         else {
138                                 $headers['To'] = implode( ", ", (array )$dest );
139                         }
140
141                         if ( $replyto ) {
142                                 $headers['Reply-To'] = $replyto->toString();
143                         }
144                         $headers['Subject'] = wfQuotedPrintable( $subject );
145                         $headers['Date'] = date( 'r' );
146                         $headers['MIME-Version'] = '1.0';
147                         $headers['Content-type'] = (is_null($contentType) ?
148                                         'text/plain; charset='.$wgOutputEncoding : $contentType);
149                         $headers['Content-transfer-encoding'] = '8bit';
150                         $headers['Message-ID'] = "<$msgid@" . $wgSMTP['IDHost'] . '>'; // FIXME
151                         $headers['X-Mailer'] = 'MediaWiki mailer';
152
153                         // Create the mail object using the Mail::factory method
154                         $mail_object =& Mail::factory('smtp', $wgSMTP);
155                         if( PEAR::isError( $mail_object ) ) {
156                                 wfDebug( "PEAR::Mail factory failed: " . $mail_object->getMessage() . "\n" );
157                                 return new WikiError( $mail_object->getMessage() );
158                         }
159
160                         wfDebug( "Sending mail via PEAR::Mail to $dest\n" );
161                         $chunks = array_chunk( (array)$dest, $wgEnotifMaxRecips );
162                         foreach ($chunks as $chunk) {
163                                 $e = self::sendWithPear($mail_object, $chunk, $headers, $body);
164                                 if( WikiError::isError( $e ) )
165                                         return $e;
166                         }
167                 } else  {
168                         # In the following $headers = expression we removed "Reply-To: {$from}\r\n" , because it is treated differently
169                         # (fifth parameter of the PHP mail function, see some lines below)
170
171                         # Line endings need to be different on Unix and Windows due to
172                         # the bug described at http://trac.wordpress.org/ticket/2603
173                         if ( wfIsWindows() ) {
174                                 $body = str_replace( "\n", "\r\n", $body );
175                                 $endl = "\r\n";
176                         } else {
177                                 $endl = "\n";
178                         }
179                         $ctype = (is_null($contentType) ? 
180                                         'text/plain; charset='.$wgOutputEncoding : $contentType);
181                         $headers =
182                                 "MIME-Version: 1.0$endl" .
183                                 "Content-type: $ctype$endl" .
184                                 "Content-Transfer-Encoding: 8bit$endl" .
185                                 "X-Mailer: MediaWiki mailer$endl".
186                                 'From: ' . $from->toString();
187                         if ($replyto) {
188                                 $headers .= "{$endl}Reply-To: " . $replyto->toString();
189                         }
190
191                         wfDebug( "Sending mail via internal mail() function\n" );
192                         
193                         $wgErrorString = '';
194                         $html_errors = ini_get( 'html_errors' );
195                         ini_set( 'html_errors', '0' );
196                         set_error_handler( array( 'UserMailer', 'errorHandler' ) );
197
198                         if (function_exists('mail')) {
199                                 if (is_array($to)) {
200                                         foreach ($to as $recip) {
201                                                 $sent = mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers );
202                                         }
203                                 } else {
204                                         $sent = mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers );
205                                 }
206                         } else {
207                                 $wgErrorString = 'PHP is not configured to send mail';
208                         }
209
210                         restore_error_handler();
211                         ini_set( 'html_errors', $html_errors );
212
213                         if ( $wgErrorString ) {
214                                 wfDebug( "Error sending mail: $wgErrorString\n" );
215                                 return new WikiError( $wgErrorString );
216                         } elseif (! $sent) {
217                                 //mail function only tells if there's an error
218                                 wfDebug( "Error sending mail\n" );
219                                 return new WikiError( 'mailer error' );
220                         } else {
221                                 return true;
222                         }
223                 }
224         }
225
226         /**
227          * Get the mail error message in global $wgErrorString
228          *
229          * @param $code Integer: error number
230          * @param $string String: error message
231          */
232         static function errorHandler( $code, $string ) {
233                 global $wgErrorString;
234                 $wgErrorString = preg_replace( '/^mail\(\)(\s*\[.*?\])?: /', '', $string );
235         }
236
237         /**
238          * Converts a string into a valid RFC 822 "phrase", such as is used for the sender name
239          */
240         static function rfc822Phrase( $phrase ) {
241                 $phrase = strtr( $phrase, array( "\r" => '', "\n" => '', '"' => '' ) );
242                 return '"' . $phrase . '"';
243         }
244 }
245
246 /**
247  * This module processes the email notifications when the current page is
248  * changed. It looks up the table watchlist to find out which users are watching
249  * that page.
250  *
251  * The current implementation sends independent emails to each watching user for
252  * the following reason:
253  *
254  * - Each watching user will be notified about the page edit time expressed in
255  * his/her local time (UTC is shown additionally). To achieve this, we need to
256  * find the individual timeoffset of each watching user from the preferences..
257  *
258  * Suggested improvement to slack down the number of sent emails: We could think
259  * of sending out bulk mails (bcc:user1,user2...) for all these users having the
260  * same timeoffset in their preferences.
261  *
262  * Visit the documentation pages under http://meta.wikipedia.com/Enotif
263  *
264  *
265  */
266 class EmailNotification {
267         protected $to, $subject, $body, $replyto, $from;
268         protected $user, $title, $timestamp, $summary, $minorEdit, $oldid, $composed_common, $editor;
269         protected $mailTargets = array();
270
271         /**
272          * Send emails corresponding to the user $editor editing the page $title.
273          * Also updates wl_notificationtimestamp.
274          *
275          * May be deferred via the job queue.
276          *
277          * @param $editor User object
278          * @param $title Title object
279          * @param $timestamp
280          * @param $summary
281          * @param $minorEdit
282          * @param $oldid (default: false)
283          */
284         function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false) {
285                 global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker;
286
287                 if ($title->getNamespace() < 0)
288                         return;
289
290                 // Build a list of users to notfiy
291                 $watchers = array();
292                 if ($wgEnotifWatchlist || $wgShowUpdatedMarker) {
293                         $dbw = wfGetDB( DB_MASTER );
294                         $res = $dbw->select( array( 'watchlist' ),
295                                 array( 'wl_user' ),
296                                 array(
297                                         'wl_title' => $title->getDBkey(),
298                                         'wl_namespace' => $title->getNamespace(),
299                                         'wl_user != ' . intval( $editor->getID() ),
300                                         'wl_notificationtimestamp IS NULL',
301                                 ), __METHOD__
302                         );
303                         while ($row = $dbw->fetchObject( $res ) ) {
304                                 $watchers[] = intval( $row->wl_user );
305                         }
306                         if ($watchers) {
307                                 // Update wl_notificationtimestamp for all watching users except
308                                 // the editor
309                                 $dbw->begin();
310                                 $dbw->update( 'watchlist',
311                                         array( /* SET */
312                                                 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
313                                         ), array( /* WHERE */
314                                                 'wl_title' => $title->getDBkey(),
315                                                 'wl_namespace' => $title->getNamespace(),
316                                                 'wl_user' => $watchers
317                                         ), __METHOD__
318                                 );
319                                 $dbw->commit();
320                         }
321                 }
322
323                 if ($wgEnotifUseJobQ) {
324                         $params = array(
325                                 "editor" => $editor->getName(),
326                                 "editorID" => $editor->getID(),
327                                 "timestamp" => $timestamp,
328                                 "summary" => $summary,
329                                 "minorEdit" => $minorEdit,
330                                 "oldid" => $oldid,
331                                 "watchers" => $watchers);
332                         $job = new EnotifNotifyJob( $title, $params );
333                         $job->insert();
334                 } else {
335                         $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers );
336                 }
337
338         }
339
340         /*
341          * Immediate version of notifyOnPageChange().
342          *
343          * Send emails corresponding to the user $editor editing the page $title.
344          * Also updates wl_notificationtimestamp.
345          *
346          * @param $editor User object
347          * @param $title Title object
348          * @param $timestamp string Edit timestamp
349          * @param $summary string Edit summary
350          * @param $minorEdit bool
351          * @param $oldid int Revision ID
352          * @param $watchers array of user IDs
353          */
354         function actuallyNotifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers) {
355                 # we use $wgPasswordSender as sender's address
356                 global $wgEnotifWatchlist;
357                 global $wgEnotifMinorEdits, $wgEnotifUserTalk;
358                 global $wgEnotifImpersonal;
359
360                 wfProfileIn( __METHOD__ );
361
362                 # The following code is only run, if several conditions are met:
363                 # 1. EmailNotification for pages (other than user_talk pages) must be enabled
364                 # 2. minor edits (changes) are only regarded if the global flag indicates so
365
366                 $isUserTalkPage = ($title->getNamespace() == NS_USER_TALK);
367                 $enotifusertalkpage = ($isUserTalkPage && $wgEnotifUserTalk);
368                 $enotifwatchlistpage = $wgEnotifWatchlist;
369
370                 $this->title = $title;
371                 $this->timestamp = $timestamp;
372                 $this->summary = $summary;
373                 $this->minorEdit = $minorEdit;
374                 $this->oldid = $oldid;
375                 $this->editor = $editor;
376                 $this->composed_common = false;
377
378                 $userTalkId = false;
379
380                 if ( !$minorEdit || ($wgEnotifMinorEdits && !$editor->isAllowed('nominornewtalk') ) ) {
381                         if ( $wgEnotifUserTalk && $isUserTalkPage ) {
382                                 $targetUser = User::newFromName( $title->getText() );
383                                 if ( !$targetUser || $targetUser->isAnon() ) {
384                                         wfDebug( __METHOD__.": user talk page edited, but user does not exist\n" );
385                                 } elseif ( $targetUser->getId() == $editor->getId() ) {
386                                         wfDebug( __METHOD__.": user edited their own talk page, no notification sent\n" );
387                                 } elseif( $targetUser->getOption( 'enotifusertalkpages' ) ) {
388                                         if( $targetUser->isEmailConfirmed() ) {
389                                                 wfDebug( __METHOD__.": sending talk page update notification\n" );
390                                                 $this->compose( $targetUser );
391                                                 $userTalkId = $targetUser->getId();
392                                         } else {
393                                                 wfDebug( __METHOD__.": talk page owner doesn't have validated email\n" );
394                                         }
395                                 } else {
396                                         wfDebug( __METHOD__.": talk page owner doesn't want notifications\n" );
397                                 }
398                         }
399
400                         if ( $wgEnotifWatchlist ) {
401                                 // Send updates to watchers other than the current editor
402                                 $userArray = UserArray::newFromIDs( $watchers );
403                                 foreach ( $userArray as $watchingUser ) {
404                                         if ( $watchingUser->getOption( 'enotifwatchlistpages' ) &&
405                                                 ( !$minorEdit || $watchingUser->getOption('enotifminoredits') ) &&
406                                                 $watchingUser->isEmailConfirmed() &&
407                                                 $watchingUser->getID() != $userTalkId )
408                                         {
409                                                 $this->compose( $watchingUser );
410                                         }
411                                 }
412                         }
413                 }
414
415                 global $wgUsersNotifiedOnAllChanges;
416                 foreach ( $wgUsersNotifiedOnAllChanges as $name ) {
417                         $user = User::newFromName( $name );
418                         $this->compose( $user );
419                 }
420
421                 $this->sendMails();
422                 wfProfileOut( __METHOD__ );
423         }
424
425         /**
426          * @private
427          */
428         function composeCommonMailtext() {
429                 global $wgPasswordSender, $wgNoReplyAddress;
430                 global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
431                 global $wgEnotifImpersonal, $wgEnotifUseRealName;
432
433                 $this->composed_common = true;
434
435                 $summary = ($this->summary == '') ? ' - ' : $this->summary;
436                 $medit   = ($this->minorEdit) ? wfMsg( 'minoredit' ) : '';
437
438                 # You as the WikiAdmin and Sysops can make use of plenty of
439                 # named variables when composing your notification emails while
440                 # simply editing the Meta pages
441
442                 $subject = wfMsgForContent( 'enotif_subject' );
443                 $body    = wfMsgForContent( 'enotif_body' );
444                 $from    = ''; /* fail safe */
445                 $replyto = ''; /* fail safe */
446                 $keys    = array();
447
448                 if( $this->oldid ) {
449                         $difflink = $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid );
450                         $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
451                         $keys['$OLDID']   = $this->oldid;
452                         $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
453                 } else {
454                         $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_newpagetext' );
455                         # clear $OLDID placeholder in the message template
456                         $keys['$OLDID']   = '';
457                         $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'created' );
458                 }
459
460                 if ($wgEnotifImpersonal && $this->oldid)
461                         /*
462                          * For impersonal mail, show a diff link to the last
463                          * revision.
464                          */
465                         $keys['$NEWPAGE'] = wfMsgForContent('enotif_lastdiff',
466                                         $this->title->getFullURL("oldid={$this->oldid}&diff=prev"));
467
468                 $body = strtr( $body, $keys );
469                 $pagetitle = $this->title->getPrefixedText();
470                 $keys['$PAGETITLE']          = $pagetitle;
471                 $keys['$PAGETITLE_URL']      = $this->title->getFullUrl();
472
473                 $keys['$PAGEMINOREDIT']      = $medit;
474                 $keys['$PAGESUMMARY']        = $summary;
475                 $keys['$UNWATCHURL']         = $this->title->getFullUrl( 'action=unwatch' );
476
477                 $subject = strtr( $subject, $keys );
478
479                 # Reveal the page editor's address as REPLY-TO address only if
480                 # the user has not opted-out and the option is enabled at the
481                 # global configuration level.
482                 $editor = $this->editor;
483                 $name    = $wgEnotifUseRealName ? $editor->getRealName() : $editor->getName();
484                 $adminAddress = new MailAddress( $wgPasswordSender, 'WikiAdmin' );
485                 $editorAddress = new MailAddress( $editor );
486                 if( $wgEnotifRevealEditorAddress
487                     && ( $editor->getEmail() != '' )
488                     && $editor->getOption( 'enotifrevealaddr' ) ) {
489                         if( $wgEnotifFromEditor ) {
490                                 $from    = $editorAddress;
491                         } else {
492                                 $from    = $adminAddress;
493                                 $replyto = $editorAddress;
494                         }
495                 } else {
496                         $from    = $adminAddress;
497                         $replyto = new MailAddress( $wgNoReplyAddress );
498                 }
499
500                 if( $editor->isIP( $name ) ) {
501                         #real anon (user:xxx.xxx.xxx.xxx)
502                         $utext = wfMsgForContent('enotif_anon_editor', $name);
503                         $subject = str_replace('$PAGEEDITOR', $utext, $subject);
504                         $keys['$PAGEEDITOR']       = $utext;
505                         $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent( 'noemailtitle' );
506                 } else {
507                         $subject = str_replace('$PAGEEDITOR', $name, $subject);
508                         $keys['$PAGEEDITOR']          = $name;
509                         $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name );
510                         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
511                 }
512                 $userPage = $editor->getUserPage();
513                 $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
514                 $body = strtr( $body, $keys );
515                 $body = wordwrap( $body, 72 );
516
517                 # now save this as the constant user-independent part of the message
518                 $this->from    = $from;
519                 $this->replyto = $replyto;
520                 $this->subject = $subject;
521                 $this->body    = $body;
522         }
523
524         /**
525          * Compose a mail to a given user and either queue it for sending, or send it now,
526          * depending on settings.
527          *
528          * Call sendMails() to send any mails that were queued.
529          */
530         function compose( $user ) {
531                 global $wgEnotifImpersonal;
532
533                 if ( !$this->composed_common )
534                         $this->composeCommonMailtext();
535
536                 if ( $wgEnotifImpersonal ) {
537                         $this->mailTargets[] = new MailAddress( $user );
538                 } else {
539                         $this->sendPersonalised( $user );
540                 }
541         }
542
543         /**
544          * Send any queued mails
545          */
546         function sendMails() {
547                 global $wgEnotifImpersonal;
548                 if ( $wgEnotifImpersonal ) {
549                         $this->sendImpersonal( $this->mailTargets );
550                 }
551         }
552
553         /**
554          * Does the per-user customizations to a notification e-mail (name,
555          * timestamp in proper timezone, etc) and sends it out.
556          * Returns true if the mail was sent successfully.
557          *
558          * @param User $watchingUser
559          * @param object $mail
560          * @return bool
561          * @private
562          */
563         function sendPersonalised( $watchingUser ) {
564                 global $wgContLang, $wgEnotifUseRealName;
565                 // From the PHP manual:
566                 //     Note:  The to parameter cannot be an address in the form of "Something <someone@example.com>".
567                 //     The mail command will not parse this properly while talking with the MTA.
568                 $to = new MailAddress( $watchingUser );
569                 $name = $wgEnotifUseRealName ? $watchingUser->getRealName() : $watchingUser->getName();
570                 $body = str_replace( '$WATCHINGUSERNAME', $name , $this->body );
571
572                 $timecorrection = $watchingUser->getOption( 'timecorrection' );
573
574                 # $PAGEEDITDATE is the time and date of the page change
575                 # expressed in terms of individual local time of the notification
576                 # recipient, i.e. watching user
577                 $body = str_replace(
578                         array(  '$PAGEEDITDATEANDTIME',
579                                 '$PAGEEDITDATE',
580                                 '$PAGEEDITTIME' ),
581                         array(  $wgContLang->timeanddate( $this->timestamp, true, false, $timecorrection ),
582                                 $wgContLang->date( $this->timestamp, true, false, $timecorrection ),
583                                 $wgContLang->time( $this->timestamp, true, false, $timecorrection ) ),
584                         $body);
585
586                 return UserMailer::send($to, $this->from, $this->subject, $body, $this->replyto);
587         }
588
589         /**
590          * Same as sendPersonalised but does impersonal mail suitable for bulk
591          * mailing.  Takes an array of MailAddress objects.
592          */
593         function sendImpersonal( $addresses ) {
594                 global $wgContLang;
595
596                 if (empty($addresses))
597                         return;
598
599                 $body = str_replace(
600                                 array(  '$WATCHINGUSERNAME',
601                                         '$PAGEEDITDATE'),
602                                 array(  wfMsgForContent('enotif_impersonal_salutation'),
603                                         $wgContLang->timeanddate($this->timestamp, true, false, false)),
604                                 $this->body);
605
606                 return UserMailer::send($addresses, $this->from, $this->subject, $body, $this->replyto);
607         }
608
609 } # end of class EmailNotification
610
611 /**
612  * Backwards compatibility functions
613  */
614 function wfRFC822Phrase( $s ) {
615         return UserMailer::rfc822Phrase( $s );
616 }
617
618 function userMailer( $to, $from, $subject, $body, $replyto=null ) {
619         return UserMailer::send( $to, $from, $subject, $body, $replyto );
620 }