SMTP authentication error

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
ntm
Forum Newbie
Posts: 3
Joined: Thu Sep 20, 2007 4:51 pm

SMTP authentication error

Post by ntm »

I have just started receiving an error message using PowWeb's e-mail servers (which I didn't receive a few days ago, and which I don't receive using Dreamhost's e-mail servers). Sample code:

Code: Select all

//Load in the files we'll need
require_once "lib/swift/Swift.php";
require_once "lib/swift/Swift/Connection/SMTP.php";
require_once "lib/swift/Swift/Authenticator/LOGIN.php";

//Start Swift
$conn =& new Swift_Connection_SMTP("mail.myserver.tld", 25);
$conn->setUsername("myusername");
$conn->setPassword("mypassword");
$conn->attachAuthenticator(new Swift_Authenticator_LOGIN());
 
$swift =& new Swift($conn);

//Create the message
$message =& new Swift_Message("My subject", "My body");
 
//Now check if Swift actually sends it
if ($swift->send($message, "to@address.tld", "from@addres.tld")) echo "Sent";
else echo "Failed";
(Obviously, "mail.myserver.tld" and the user name/password are filled in with the appropriate data)

The error message:
PHP Fatal error:
Uncaught Error of type [swift_connection_exception] with message [Authentication failed using username 'myusername' and password '**********']
@0 swift::swift() in /path/to/swifttest.php on line 14
@1 swift::connect() in /path/to/lib/swift/Swift.php on line 111
@2 swift::handshake() in /path/to/lib/swift/Swift.php on line 245

in /path/to/lib/swift/Swift/Errors.php on line 99
I've tried using CRAM-MD5 (which doesn't work at all) and PLAIN, too (same result as with LOGIN). I assume that PowWeb have changed something at their end, but getting reliable information out of them isn't always easy; is this error regularly run into and is there a general solution?

I'd greatly appreciate any help!
chuckl
Forum Commoner
Posts: 61
Joined: Wed May 23, 2007 7:36 am

Post by chuckl »

I would guess that either your host does not recognise your username or password, or you are using the wrong username/password or login protocol.

Possibly you could telnet to port 25 or whatever is used on the mail server, type helo or ehlo and see what options it offers?
ntm
Forum Newbie
Posts: 3
Joined: Thu Sep 20, 2007 4:51 pm

Post by ntm »

Turns out that this is probably a symptom of a larger problem - I can no longer use the PowWeb servers to send e-mails from Thunderbird, either, so I'm guessing it's entirely down to their system and have requested that they look into it...

Tried telnet earlier, but couldn't connect at all.
Post Reply