php mail n google smtp server
Posted: Mon Dec 28, 2009 11:52 pm
how can we use google smtp server to send mail using php
here's my current php script
here's my current php script
Code: Select all
<?php
$toName = "my name";
$toEmail = "myemail@domain.com";
$subject = "success";
$name = $_POST["name"];
$email = $_POST["email"];
$headers = "From: Your Name <myemail@domain.com>" . "\r\n";
$headers .= "Reply-To: Your Name <myemail@domain.com>" . "\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$message= "name: $name
email: $email
";
$replySubject = "Mail from me";
$replyMessage = "I will reply to your query soon";
// send email to You //
mail($toName." <".$toEmail.">", $subject, $message, "From: ".$name." <".$email.">");
// send email to You //
print "process=complete";
// send reply email to inquirer //
mail ($name." <".$email.">", $replySubject, $replyMessage, $headers);
// send reply email to inquirer //
?>