php mail n google smtp server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
angelic_devil
Forum Commoner
Posts: 74
Joined: Thu Apr 02, 2009 7:05 am

php mail n google smtp server

Post 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 //
 
?>
 
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: php mail n google smtp server

Post by omniuni »

You need to edit your server's PHP configuration file to the SMTP server of your choice.
angelic_devil
Forum Commoner
Posts: 74
Joined: Thu Apr 02, 2009 7:05 am

Re: php mail n google smtp server

Post by angelic_devil »

how?
plz elaborate
Post Reply