sending email using gmail server [duplicate]

Question!

Possible Duplicate:
Send email using GMail SMTP server from PHP page

Hi

I want to send email using gmail server for my php site. Can anyone help me with the code using phpmailer for accomplishing this?

require("phpmailer/class.phpmailer.php");

$mail = new PHPMailer();    
$mail->IsSMTP(); // send via SMTP
IsSMTP(); // send via SMTP

$mail->SMTPAuth = true; // turn on SMTP authentication  
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "mailpass"; // SMTP password
$webmaster_email = "[email protected]"; //Reply to this email ID
$email="[email protected]"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject"; 
$mail->Body = "Hi, This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body

if(!$mail->Send())
{
    echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
    echo "Message has been sent";
}


This video can help you solving your question :)
By: admin

PHPMailer SMTP Error 550

My server and php mail() function sends email to the spam folder

How to use PHPmailer? Help me with its API

PHPMailer Lite & GMAIL SMTP: emails not sent to Yahoo Mail, how to debug?

PHP, PHPMailer: Can't get example code for PHPMailer to work

PHPMailer Works on WAMP but not on Production Server

sending email using gmail server [duplicate]

fsockopen returns 'bool(false)' from browser but 'resource(4) of type (stream)' from command line

PHP on GoDaddy Linux Shared trying to send through GMAIL SMTP

PHPMailer or SwiftMailer? [duplicate]

Problem with SMTP emails sent via PhpMailer: Helo Not Accepted