diff -u b/core/lib/Drupal/Core/Mail/MailInterface.php b/core/lib/Drupal/Core/Mail/MailInterface.php --- b/core/lib/Drupal/Core/Mail/MailInterface.php +++ b/core/lib/Drupal/Core/Mail/MailInterface.php @@ -17,7 +17,8 @@ interface MailInterface { /** - * Formats a message composed by \Drupal::service('plugin.manager.mail')->mail() prior sending. + * Formats a message composed by + * \Drupal::service('plugin.manager.mail')->mail() prior sending. * * Allows to preprocess, format, and postprocess a mail message before it is * passed to the sending system. By default, all messages may contain HTML and @@ -36,7 +37,8 @@ public function format(array $message); /** - * Sends a message composed by \Drupal::service('plugin.manager.mail')->mail(). + * Sends a message composed by + * \Drupal::service('plugin.manager.mail')->mail(). * * @param array $message * Message array with at least the following elements: diff -u b/core/modules/system/system.api.php b/core/modules/system/system.api.php --- b/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -297,23 +297,27 @@ } /** - * Alter an email message created with the drupal_mail() function. + * Alter an email message created with the + * \Drupal::service('plugin.manager.mail')->mail function. * * hook_mail_alter() allows modification of email messages created and sent - * with drupal_mail(). Usage examples include adding and/or changing message - * text, message fields, and message headers. + * with \Drupal::service('plugin.manager.mail')->mail(). Usage examples include + * adding and/or changing message text, message fields, and message headers. * - * Email messages sent using functions other than drupal_mail() will not - * invoke hook_mail_alter(). For example, a contributed module directly + * Email messages sent using functions other than + * \Drupal::service('plugin.manager.mail')->mail() will not invoke + * hook_mail_alter(). For example, a contributed module directly * calling the drupal_mail_system()->mail() or PHP mail() function - * will not invoke this hook. All core modules use drupal_mail() for - * messaging, it is best practice but not mandatory in contributed modules. + * will not invoke this hook. All core modules use + * \Drupal::service('plugin.manager.mail')->mail() for messaging, it is best + * practice but not mandatory in contributed modules. * * @param $message * An array containing the message data. Keys in this array include: * - 'id': - * The drupal_mail() id of the message. Look at module source code or - * drupal_mail() for possible id values. + * The \Drupal::service('plugin.manager.mail')->mail() id of the message. + * Look at module source code or + * \Drupal::service('plugin.manager.mail')->mail() for possible id values. * - 'to': * The address or addresses the message will be sent to. The * formatting of this string must comply with RFC 2822. @@ -331,15 +335,16 @@ * Associative array containing mail headers, such as From, Sender, * MIME-Version, Content-Type, etc. * - 'params': - * An array of optional parameters supplied by the caller of drupal_mail() - * that is used to build the message before hook_mail_alter() is invoked. + * An array of optional parameters supplied by the caller of + * \Drupal::service('plugin.manager.mail')->mail() that is used to build + * the message before hook_mail_alter() is invoked. * - 'language': * The language object used to build the message before hook_mail_alter() * is invoked. * - 'send': * Set to FALSE to abort sending this email message. * - * @see drupal_mail() + * @see \Drupal\Core\Mail\MailInterface::mail() */ function hook_mail_alter(&$message) { if ($message['id'] == 'modulename_messagekey') { @@ -419,33 +424,40 @@ } /** - * Prepare a message based on parameters; called from drupal_mail(). + * Prepare a message based on parameters; called from + * \Drupal::service('plugin.manager.mail')->mail(). * * Note that hook_mail(), unlike hook_mail_alter(), is only called on the - * $module argument to drupal_mail(), not all modules. + * $module argument to + * \Drupal::service('plugin.manager.mail')->mail(), not all modules. * * @param $key * An identifier of the mail. * @param $message * An array to be filled in. Elements in this array include: - * - id: An ID to identify the mail sent. Look at module source code - * or drupal_mail() for possible id values. + * - id: An ID to identify the mail sent. Look at module source code or + * \Drupal::service('plugin.manager.mail')->mail() for possible id values. * - to: The address or addresses the message will be sent to. The * formatting of this string must comply with RFC 2822. * - subject: Subject of the email to be sent. This must not contain any - * newline characters, or the mail may not be sent properly. drupal_mail() - * sets this to an empty string when the hook is invoked. + * newline characters, or the mail may not be sent properly. + * \Drupal::service('plugin.manager.mail')->mail() sets this to an empty + * string when the hook is invoked. * - body: An array of lines containing the message to be sent. Drupal will - * format the correct line endings for you. drupal_mail() sets this to an + * format the correct line endings for you. + * \Drupal::service('plugin.manager.mail')->mail() sets this to an * empty array when the hook is invoked. * - from: The address the message will be marked as being from, which is - * set by drupal_mail() to either a custom address or the site-wide - * default email address when the hook is invoked. + * set by \Drupal::service('plugin.manager.mail')->mail() to either a + * custom address or the site-wide default email address when the hook is + * invoked. * - headers: Associative array containing mail headers, such as From, - * Sender, MIME-Version, Content-Type, etc. drupal_mail() pre-fills - * several headers in this array. + * Sender, MIME-Version, Content-Type, etc. + * \Drupal::service('plugin.manager.mail')->mail() pre-fills several + * headers in this array. * @param $params - * An array of parameters supplied by the caller of drupal_mail(). + * An array of parameters supplied by the caller of + * \Drupal::service('plugin.manager.mail')->mail(). */ function hook_mail($key, &$message, $params) { $account = $params['account']; @@ -757,26 +769,23 @@ } /** - * Alter an email message created with the \Drupal::service('plugin.manager.mail')->mail function. + * Alter an email message created with the drupal_mail() function. * * hook_mail_alter() allows modification of email messages created and sent - * with \Drupal::service('plugin.manager.mail')->mail(). Usage examples include - * adding and/or changing message text, message fields, and message headers. + * with drupal_mail(). Usage examples include adding and/or changing message + * text, message fields, and message headers. * - * Email messages sent using functions other than - * \Drupal::service('plugin.manager.mail')->mail() will not invoke - * hook_mail_alter(). For example, a contributed module directly + * Email messages sent using functions other than drupal_mail() will not + * invoke hook_mail_alter(). For example, a contributed module directly * calling the drupal_mail_system()->mail() or PHP mail() function - * will not invoke this hook. All core modules use - * \Drupal::service('plugin.manager.mail')->mail() for messaging, it is best - * practice but not mandatory in contributed modules. + * will not invoke this hook. All core modules use drupal_mail() for + * messaging, it is best practice but not mandatory in contributed modules. * * @param $message * An array containing the message data. Keys in this array include: * - 'id': - * The \Drupal::service('plugin.manager.mail')->mail() id of the message. - * Look at module source code or - * \Drupal::service('plugin.manager.mail')->mail() for possible id values. + * The drupal_mail() id of the message. Look at module source code or + * drupal_mail() for possible id values. * - 'to': * The address or addresses the message will be sent to. The * formatting of this string must comply with RFC 2822. @@ -794,16 +803,15 @@ * Associative array containing mail headers, such as From, Sender, * MIME-Version, Content-Type, etc. * - 'params': - * An array of optional parameters supplied by the caller of - * \Drupal::service('plugin.manager.mail')->mail() that is used to build - * the message before hook_mail_alter() is invoked. + * An array of optional parameters supplied by the caller of drupal_mail() + * that is used to build the message before hook_mail_alter() is invoked. * - 'language': * The language object used to build the message before hook_mail_alter() * is invoked. * - 'send': * Set to FALSE to abort sending this email message. * - * @see \Drupal\Core\Mail\MailInterface::mail() + * @see drupal_mail() */ function hook_mail_alter(&$message) { if ($message['id'] == 'modulename_messagekey') { @@ -1148,39 +1156,33 @@ } /** - * Prepare a message based on parameters; called from \Drupal::service('plugin.manager.mail')->mail(). + * Prepare a message based on parameters; called from drupal_mail(). * * Note that hook_mail(), unlike hook_mail_alter(), is only called on the - * $module argument to - * \Drupal::service('plugin.manager.mail')->mail(), not all modules. + * $module argument to drupal_mail(), not all modules. * * @param $key * An identifier of the mail. * @param $message * An array to be filled in. Elements in this array include: - * - id: An ID to identify the mail sent. Look at module source code or - * \Drupal::service('plugin.manager.mail')->mail() for possible id values. + * - id: An ID to identify the mail sent. Look at module source code + * or drupal_mail() for possible id values. * - to: The address or addresses the message will be sent to. The * formatting of this string must comply with RFC 2822. * - subject: Subject of the email to be sent. This must not contain any - * newline characters, or the mail may not be sent properly. - * \Drupal::service('plugin.manager.mail')->mail() sets this to an empty - * string when the hook is invoked. + * newline characters, or the mail may not be sent properly. drupal_mail() + * sets this to an empty string when the hook is invoked. * - body: An array of lines containing the message to be sent. Drupal will - * format the correct line endings for you. - * \Drupal::service('plugin.manager.mail')->mail() sets this to an + * format the correct line endings for you. drupal_mail() sets this to an * empty array when the hook is invoked. * - from: The address the message will be marked as being from, which is - * set by \Drupal::service('plugin.manager.mail')->mail() to either a - * custom address or the site-wide default email address when the hook is - * invoked. + * set by drupal_mail() to either a custom address or the site-wide + * default email address when the hook is invoked. * - headers: Associative array containing mail headers, such as From, - * Sender, MIME-Version, Content-Type, etc. - * \Drupal::service('plugin.manager.mail')->mail() pre-fills several - * headers in this array. + * Sender, MIME-Version, Content-Type, etc. drupal_mail() pre-fills + * several headers in this array. * @param $params - * An array of parameters supplied by the caller of - * \Drupal::service('plugin.manager.mail')->mail(). + * An array of parameters supplied by the caller of drupal_mail(). */ function hook_mail($key, &$message, $params) { $account = $params['account']; diff -u b/core/modules/user/user.module b/core/modules/user/user.module --- b/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1267,7 +1267,7 @@ * operation happens on the given user account. * * @see user_mail_tokens() - * @see drupal_mail() + * @see \Drupal\Core\Mail\MailInterface::mail() * * @param $op * The operation being performed on the account. Possible values: @@ -1275,7 +1275,7 @@ * operation happens on the given user account. * * @see user_mail_tokens() - * @see \Drupal\Core\Mail\MailInterface::mail() + * @see drupal_mail() * * @param $op * The operation being performed on the account. Possible values: