Thursday, 8 September 2011

Sending email in PHP from Gmail

For sending email in PHP by Gmail id, I have used phpmailer class.
Note that php_openssl must be un-commented in the php.ini file.
In phpMailer directory open "class.phpgmailer.php"  and change the line as listed below:
var $Host        = "ssl://";
var $Port        = 465;

Put listed below code in php file from where you want to send email.
$mailToClient=new PHPGMailer();
$mailToClient->Subject='YOUR-SUBJECT';//sending mail
$mailToClient->AddAddress('recipient email address here');
$mailToClient->Body='Hey, Here is Parvez!';

No comments:

Post a Comment