GMail Authentication - Strange
Posted: Tue Jan 22, 2008 9:25 pm
Hi there,
Firstly, great work on Swift Mailer. Does exactly what I want and a lot faster than PHPMailer. Unfortunately, I'm running into a really bizarre issue with Gmail.
Occasionally it throws up errors like so:
Here's my PHP code
Bizarrely, this happens completely randomly. I know my authentication is good, because I can manually login to Gmail using the same details. Any ideas? Is this likely just an issue with the Gmail SMTP servers?
Thanks.
Firstly, great work on Swift Mailer. Does exactly what I want and a lot faster than PHPMailer. Unfortunately, I'm running into a really bizarre issue with Gmail.
Occasionally it throws up errors like so:
Code: Select all
PHP Fatal error: <br /><strong>Uncaught Error</strong> of type [swift_connectionexception] with message [Authentication failed using username 'me@gmail.com' and password '*******'<h3>Log Information</h3><pre>++ Log level changed to 4
++ Authentication mechanism 'LOGIN' attached.
++ Trying to connect...
++ Trying to connect to SMTP server at 'tls://smtp.gmail.com:465
<< 220 mx.google.com ESMTP n33sm14073506wag.47
>> EHLO localhost.localdomain
<< 250-mx.google.com at your service, [64.13.231.44]
250-SIZE 28311552
250-8BITMIME
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODES
++ SMTP extension 'SIZE' reported with attributes [28311552].
++ SMTP extension '8BITMIME' reported with attributes [].
++ SMTP extension 'AUTH' reported with attributes [LOGIN, PLAIN].
++ SMTP extension 'ENHANCEDSTATUSCODES' reported with attributes [].
++ Trying to authenticate with username 'me@gmail.com'.
++ Trying 'LOGIN' authentication...
>> AUTH LOGIN
<< 334 VXNlcm5hbWU6
>> cmVnaXN0cmF0aW in /var/www/vhosts/mydomain/httpdocs/inc/php/lib/Swift/Errors.php on line 99
Content-type: text/html
X-Powered-By: PHP/4.3.9
Code: Select all
<?php
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
// Set Logging:
$log =& Swift_LogContainer::getLog();
$log->setLogLevel(4);
// Create connection with authentication
$conn = new Swift_Connection_SMTP("smtp.gmail.com", 465, SWIFT_SMTP_ENC_TLS);
$conn->setUsername('me@gmail.com');
$conn->setPassword('mypassword');
$smtp =& new Swift($conn);
$message =& new Swift_Message("Test Subject", "Test Body";
if ($smtp->send($message, "someoneelse@gmail.com", "me@gmail.com")) {
// Succeeded:
$log =& Swift_LogContainer::getLog();
echo $log->dump(true);
}
else {
// Failed:
$log =& Swift_LogContainer::getLog();
echo $log->dump(true);
}
}
?>
Thanks.