sending email using gmail server [duplicate]


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


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


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

$mail->SMTPAuth = true; // turn on SMTP authentication  
$mail->Username = ""; // SMTP username
$mail->Password = "mailpass"; // SMTP password
$webmaster_email = ""; //Reply to this email ID
$email=""; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "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

    echo "Mailer Error: " . $mail->ErrorInfo;
    echo "Message has been sent";

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