Monday, May 14, 2012

phpgmailer set from mail issue

I'm trying to use php mail class as shown in the example.



http://www.vulgarisoip.com/category/phpgmailer/



I'm using it my site's contact us form. Can I set the "$mail->From" address as the person who filled the form? When i reveive the mail it always shows that the "from address" as my gmail account. Any help would really helpful.



<?php
require_once('phpgmailer/class.phpgmailer.php');
$mail = new PHPGMailer();
$mail->Username = 'username@gmail.com';
$mail->Password = 'gmailpassword';
$mail->From = 'from@hotmail.com'; // Like to set this address as the address of the person who filled the form
$mail->FromName = 'User Name';
$mail->Subject = 'Subject';
$mail->AddAddress('myname@mydomain.com'); // To which address the mail to be delivered
$mail->Body = 'Hey buddy, heres an email!';
$mail->Send();


?>




No comments:

Post a Comment