Dear Friends,
I am trying to send the mail to the gmail using the below code. But nothing is happening. When I click the submit button in web pags, a blank page displays.
I am struggling very hard. Pls help. Also if you have any working code, pls share with me. Thanks a lot in advance.
<?php
require_once("class.phpmailer.php");
$mail = new PHPMailer();
$body = "hi welcome";
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "mymail@gmail.com";
$mail->Password = "mypwd";
$mail->SetFrom('mymail1@rediffmail.com');
$mail->AddReplyTo("mymail1@rediffmail.com");
$mail->Subject = "PHPMailer Testing";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "polymers24@gmail.com";
$mail->AddAddress($address, "Polymers");
.if(!$mail->Send()) {
.echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
PHP mail not sending to gmail
Moderator: General Moderators
Re: PHP mail not sending to gmail
Any improvement if you change this:
?
into:dineshsjce wrote:Code: Select all
$mail->SMTPSecure = "tls"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465;
Code: Select all
$mail->Host = "ssl://smtp.gmail.com:465";-
dineshsjce
- Forum Newbie
- Posts: 2
- Joined: Wed Jun 29, 2011 8:27 am
Re: PHP mail not sending to gmail
Thanks for your reply. But no luck 