Amit Dhamu

Writes Code

Mail in PHP

$from_name = "Joe Bloggs";
$from_email = "joe.bloggs@gmail.com";
$from_msg = "Just wanted to say hi!";
$headers = "From: $from_name" . "rn";
$headers .= "Reply-To: $from_email" . "rn";

$subject = "Mail Test";
$to = "Amit Dhamu <me@me.com>";

if($from_name == "" || $from_email == "" || $from_msg == "") {
    // Fields are empty - kill the script
 exit;
}

if(mail($to, $subject, $from_msg, $headers)) {
  // Mail successfully sent
 exit;
} else {
   // There was an error sending the email.
  exit;
}


mail / php / email

← Device and Size Detection Conditional IE Statements →