Jump to content

Want to send email with PHP using PHPMailer?Giving error.


Recommended Posts

Posted

Error: SMTP NOTICE: EOF caught while checking if connected SMTP connect() failed. Mailer Error: SMTP connect() failed.

<?php
	require('class.phpmailer.php');
	$mail = new PHPMailer();// create a new object
        $mail ->IsSMTP(); // enable SMTP
        $mail ->SMTPDebug = 1; // debugg ing: 1 = errors and messages, 2 = messages only        $mail->SMTPAuth = true; // authentication enabled
	$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
	$mail->Host = "smtp.gmail.com";
	$mail->Port = 587; // or 465
	$mail->IsHTML(true);
	$mail->Username = "biz.online321@gmail.com";
	$mail->Password = "mudunuru%^&";
	$mail->SetFrom("example@gmail.com");
	$mail->Subject = "Test";
        $mail->Body = "hello";
	$mail->AddAddress("varma.sfi123@gmail.com");
	if(!$mail->Send())
	  {
	    echo "Mailer Error: " . $mail->ErrorInfo;
	  }
	else
          {
	    echo "Message has been sent";
	  }
?>

Your help will be appericiated

Posted (edited)

I could suggest using this or this module to send mail via SMTP instead. They are very easy to use and extend WireMail class which is future-proof as it will be used in PW 2.5 core. They work only in dev version though.

The links are the same as in Martijn's post, don't bother to compare ))

Edited by Ivan Gretsky
  • Like 3
×
×
  • Create New...