PHP Manual
Prev |  | Next

# mail

mail -- send mail

## Description

`bool mail`(string to, string subject, string message, string [additional_headers]);

Mail() automatically mails the message specified in `message` to the receiver specified in `to`. Multiple recipients can be specified by putting a comma between each address in `to`.

Example 1. Sending mail.
    mail("rasmus@lerdorf.on.ca", "My Subject", "Line 1\nLine 2\nLine 3");

If a fourth string argument is passed, this string is inserted at the end of the header. This is typically used to add extra headers. Multiple extra headers are separated with a newline.

Example 2. Sending mail with extra headers.
    mail("nobody@aol.com", "the subject", $message,
         "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion());

Prev | Home | Next
Mail functions | Up | Mathematical functions