How to Send Mail Using PHP

Mailing is very important functionality in any web application,in PHP to send mail is very using php mail() function.PHP mail() function is used to send mail from web server.You can send mail as a plain text or with html element.

You can add html content and css styles with message body of mail.I am sharing separate article for send html email using PHP.

PHP mail() function has features to send mail to multiple recipients using php email headers.You can add in mail header like From, Cc, and Bcc using php mail headers.

You can also check other tutorial of php mail,

The syntax of php mail function is:

Where mail() Parameters are:

  • to : This is used to Receiver email id, or receivers email ids of the mail.
  • subject : Subject of the email to be sent.
  • message : Message to be sent.
  • additional_headers : This will use to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n).

Sample Code To Send Mail Using PHP