Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PhpMail.php

function 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|string $additional_headers: (optional) String or 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 168

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, array|string $additional_headers = [], string $additional_params = '') : bool {
    return @mail($to, $subject, $message, $additional_headers, $additional_params);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal