PHP Classes

help in using phpmailer with gmail

Recommend this page to a friend!

      PHPMailer  >  All threads  >  help in using phpmailer with gmail  >  (Un) Subscribe thread alerts  
Subject:help in using phpmailer with gmail
Summary:helps needed in phpmailer
Messages:2
Author:nagendra prasad
Date:2006-07-09 12:05:20
Update:2010-01-05 07:35:02
 

  1. help in using phpmailer with gmail   Reply   Report abuse  
Picture of nagendra prasad nagendra prasad - 2006-07-09 12:05:20
hello
I have been trying to use my gmail account to generate a mail in php. i have used the php mailer class for the same. i have done the folowing change in the class.smtp.php file:

Pasted this code
$host = "ssl://smtp.gmail.com";
$port = 465;
before the line 104 #connect to the smtp server

Next i have used the following code as my mail.php file which will generate the mail:


<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username@gmail.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$webmaster_email = "username@doamin.com"; //Reply to this email ID
$email="username@domain.com"; // 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";
}
?>

but i am getting the following error...

Fatal error: Maximum execution time of 60 seconds exceeded in D:\wamp\www\class.smtp.php on line 1024

Can anyone please give the correct settings that has to be done in the class files...or is there any other class files tht are available to send a mail using the gmail account..plz help

  2. Re: help in using phpmailer with gmail   Reply   Report abuse  
Picture of pradeep lance pradeep lance - 2010-01-05 07:35:02 - In reply to message 1 from nagendra prasad
thanks bro its working