public function MailInterface::mail

Sends a message composed by drupal_mail().

Parameters

array $message: Message array with at least the following elements:

  • id: A unique identifier of the e-mail type. Examples: 'contact_user_copy', 'user_password_reset'.
  • to: The mail address or addresses where the message will be sent to. The formatting of this string must comply with RFC 2822. Some examples:

    • subject: Subject of the e-mail to be sent. This must not contain any newline characters, or the mail may not be sent properly.
    • body: Message to be sent. Accepts both CRLF and LF line-endings. E-mail bodies must be wrapped. You can use drupal_wrap_mail() for smart plain text wrapping.
    • headers: Associative array containing all additional mail headers not defined by one of the other parameters. PHP's mail() looks for Cc and Bcc headers and sends the mail to addresses in these headers too.

Return value

bool TRUE if the mail was successfully accepted for delivery, otherwise FALSE.

2 methods override MailInterface::mail()
MailTest::mail in drupal/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
Send function that is called through the mail system.
PhpMail::mail in drupal/core/lib/Drupal/Core/Mail/PhpMail.php
Sends an e-mail message, using Drupal variables and default settings.

File

drupal/core/lib/Drupal/Core/Mail/MailInterface.php, line 51
Definition of Drupal\Core\Mail\MailInterface.

Class

MailInterface
Defines an interface for pluggable mail back-ends.

Namespace

Drupal\Core\Mail

Code

public function mail(array $message);