How to send mail using PHP?

Use PHP built in mail() function to send email.

The syntax is:

mail($to, $subject, $message, $mailheaders);

$mailheaders include return path, from and reply-to information, typical example is:

$mailheaders="Return-path: $name<$email>n";
$mailheaders.="From: $name<$email>n";
$mailheaders.="Reply-To: $emailn";

$message is the message you want to send, for example:

$message="This is my first email using PHP mail function.";

$subject is the subject of the email and $to is the recipient email.

Show Form
No comments yet. Be the first to add a comment!