webCOMAND

mail::mail()

Send a simple email with optional headers.

Prototype

boolean mail(mixed $to, string $subject, string $message, $headers = NULL)

Parameters

  • to - String containing an email address or comma-separated list of email addresses, or an array of email addresses.  Each email address can be a simple email address or a title and email address in "<Full Name> name@example.com" format.
  • subject - String containing the email subject.  If the subject contains UTF8 or other encoded characters, you must manually encode the subject yourself.  For example, '=?utf-8?B?'.base64_encode('sÜßject').
  • message - Plain-text email message.  If sending HTML, UTF8 or other encodings, make sure to set the Content-Type and other headers accordingly.
  • headers - Optional array (associative key/value pairs or simple colon-separated strings) of standard email headers.  For more information, see headers().

Return

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

Just because the mail was accepted for delivery does NOT mean it will actually reach the intended destination or recipient Inbox.  It may be silently rejected, quarantined or delivered to a Junk Mail, spam or other folder.

Example

\io_comand_email\mail::mail(
    'webmaster@webcomand.com',
    'Testing',
    "This is a test.\nTesting 1, 2, 3."
);