I had it totally working before, but I reinstalled ubuntu 13.10 on my server and now it doesnt work, my code is as follows:
require 'php/PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 'mail@gmail.com';
$mail->Password = 'pass';
$mail->setFrom('mail@gmail.com', 'First Last');
$mail->addAddress('mail2@hotmail.com', 'Random person');
$mail->Subject = 'PHPMailer GMail SMTP test';
$mail->msgHTML('prueba');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
mail, mail2 and pass are just safewords, they are valid addresses and password.
OpenSSL is installed and working with a temporary cert.
Any ideas of why it doesnt work now after Ubuntu 13.10 reinstall?
Forgot to tell, the error Im getting now is:
SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0) SMTP connect() failed. Mailer Error: SMTP connect() failed.