vendredi 17 avril 2015

PHPMailer error - SMTP connect() failed

I get this error when trying to use PHPMailer to send mail:



2015-04-17 09:33:36 SERVER -> CLIENT: 220 extrelay0.dodo.com.au ESMTP (Ubuntu)
2015-04-17 09:33:36 CLIENT -> SERVER: EHLO www.mydomain.com.au
2015-04-17 09:33:36 SERVER -> CLIENT: 250-extrelay0.myisp.com.au 250-PIPELINING 250-SIZE 20480000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN
2015-04-17 09:33:36 CLIENT -> SERVER: QUIT
2015-04-17 09:33:36 SERVER -> CLIENT: 221 2.0.0 Bye
2015-04-17 09:33:36 SMTP connect() failed.


I'm not sure how to read that error message, though. Looks like it connects then something happens and it quits for some reason?


I can send emails from SMTP through outlook so I'm not sure why this isn't working. Here is the php code I'm using:



require ("/var/www/mydomain/htdocs/wp-content/themes/mytheme/lib/PHPMailer/PHPMailerAutoload.php");
...
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Port = 25;
$mail->Host = "smtp.myisp.com.au";
$mail->SMTPAuth = true;
$mail->Username = "myispusername";
$mail->Password = "mypassword";
$mail->From = "test@email.com";
$mail->FromName = "test";
$mail->AddAddress = "me@live.com.au";
$mail->IsHTML(true);
$mail->Subject = "Contact form email";
$mail->Body = "Test email";
$sent = $mail->send();

Aucun commentaire:

Enregistrer un commentaire