PageRenderTime 55ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/mediawiki-1.16.5/includes/UserMailer.php

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