function PhpMail::doMail

Same name in other branches
  1. 10 core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php \Drupal\Core\Mail\Plugin\Mail\PhpMail::doMail()
  2. 11.x core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php \Drupal\Core\Mail\Plugin\Mail\PhpMail::doMail()

Wrapper around PHP's mail() function.

We suppress warnings and notices from mail() because of issues on some hosts. The return value of this method will still indicate whether mail was sent successfully.

Parameters

string $to: Receiver, or receivers of the mail.

string $subject: Subject of the email to be sent.

string $message: Message to be sent.

array $additional_headers: (optional) Array to be inserted at the end of the email header.

string $additional_params: (optional) Can be used to pass additional flags as command line options.

See also

mail()

1 call to PhpMail::doMail()
PhpMail::mail in core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
Sends an email message.

File

core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php, line 172

Class

PhpMail
Defines the default Drupal mail backend, using PHP's native mail() function.

Namespace

Drupal\Core\Mail\Plugin\Mail

Code

protected function doMail(string $to, string $subject, string $message, $additional_headers = [], string $additional_params = '') : bool {
    return @mail($to, $subject, $message, $additional_headers, $additional_params);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.