Send an e-mail message, using Drupal variables and default settings. More information in the <a href="http://php.net/manual/en/function.mail.php"> PHP function reference for mail()</a>. See drupal_mail() for information on how $message is composed.

Parameters

$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 5322. Some examples are:

  • 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 mail headers.

Return value

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

1 call to drupal_mail_send()
drupal_mail in includes/mail.inc
Compose and optionally send an e-mail message.

File

includes/mail.inc, line 173

Code

function drupal_mail_send($message) {

  // Allow for a custom mail backend.
  if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) {
    include_once './' . variable_get('smtp_library', '');
    return drupal_mail_wrapper($message);
  }
  else {
    $mimeheaders = array();
    foreach ($message['headers'] as $name => $value) {
      $mimeheaders[] = $name . ': ' . mime_header_encode($value);
    }
    return mail($message['to'], mime_header_encode($message['subject']), str_replace("\r", '', $message['body']), join("\n", $mimeheaders));
  }
}