How to send email using PHP?

Now a days email communication is very important, So now will see how to send email using PHP.

Find below code:

$com_email = ""; // your domain email
$to = "";  //to whom you want to send email
$subject = "My subject"; //your email subject
$txt = "Hello world!"; //your email message/content
$headers = "From: Survey Form <$com_email> \r\n";  //to avoid spam
mail($to,$subject,$txt,$headers,"-f$com_email"); //to avoid spam
Tagged as: