Page 1 of 1

php mail n google smtp server

Posted: Mon Dec 28, 2009 11:52 pm
by angelic_devil
how can we use google smtp server to send mail using php

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 //
 
?>
 

Re: php mail n google smtp server

Posted: Tue Dec 29, 2009 2:32 am
by omniuni
You need to edit your server's PHP configuration file to the SMTP server of your choice.

Re: php mail n google smtp server

Posted: Tue Dec 29, 2009 2:35 am
by angelic_devil
how?
plz elaborate