The mail() function allows you to send emails directly from a script.
This function returns TRUE if the email was successfully accepted for delivery, otherwise it returns FALSE.
|to||Required. Specifies the receiver / receivers of the email|
|subject||Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters|
|message||Required. Defines the message to be sent. Each line should be separated with a LF (\n).
Lines should not exceed 70 characters.
Windows note: If a full stop is found on the beginning
of a line in the message, it might be removed. To solve this problem, replace the
full stop with a double dot:
additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n).
Note: When sending an email, it must contain a From header. This can be set with this parameter or in the php.ini file.
|parameters||Optional. Specifies an additional parameter to the sendmail program (the one defined in the sendmail_path configuration setting). (i.e. this can be used to set the envelope sender address when using sendmail with the -f sendmail option)|
Note: Keep in mind that just because the email was accepted for delivery, it does NOT mean the email is actually sent and received.
Send a simple email:
Send an email with extra headers:
Send an HTML email:
Your message has been sent to W3Schools.