You are here

public function MailHandlerInterface::sendMail in Commerce Core 8.2

Sends an email to a user.

Parameters

string $to: The address the email will be sent to. Must comply with RFC 2822.

string $subject: The subject. Must not contain any newline characters.

array $body: A render array representing the message body.

array $params: Email parameters. Recognized keys:

  • id: A unique identifier of the email type. Allows hook_mail_alter() implementations to identify specific emails. Defaults to "mail". Automatically prefixed with "commerce_".
  • from: The address the email will be marked as being from. Defaults to the current store email.
  • reply-to: The address to which the reply will be sent. No default.
  • cc: The CC address or addresses (separated by a comma). No default.
  • bcc: The BCC address or addresses (separated by a comma). No default.
  • langcode: The email langcode. Every translatable string and entity will be rendered in this language. Defaults to the current language.

Return value

bool TRUE if the email was sent successfully, FALSE otherwise.

1 method overrides MailHandlerInterface::sendMail()
MailHandler::sendMail in src/MailHandler.php
Sends an email to a user.

File

src/MailHandlerInterface.php, line 41

Class

MailHandlerInterface
Handles the assembly and dispatch of HTML emails.

Namespace

Drupal\commerce

Code

public function sendMail($to, $subject, array $body, array $params = []);