and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I can't seem to connect using SMTP Authentication. The error I keep getting is that it cannot connect to the server and connection is timing out. This is what I have for my code:
//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");
$swift =& new Swift($conn);
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
If it's timing out it's got nothing to do with authentication and more to do with network restrictions in place on your hosting account. Who's your host? GoDaddy are a no-go for one.
Here's what I have:
$smtp =& new Swift_Connection_SMTP(mailserver", PortNumber);
$smtp->attachAuthenticator(new Swift_Authenticator_LOGIN());
$smtp->setUsername("username");
$smtp->setPassword("password");
$smtp->setTimeout(60);
I changed the timeout seconds because I wanted to see what happens. When I run this, I get nothing back. My code stops executing at exactly 30 seconds even with time out set to 60.
When I remove the setTimeout(), this is the error I get:
Fatal error:
Uncaught Error of type [Swift_Connection_Exception] with message [The SMTP connection failed to start [mailserver:PortNumber]: fsockopen returned Error Number 110 and Error String 'Connection timed out']
@0 Swift::Swift() in blahblahblah on line 23
@1 Swift::connect() in blahblahblah on line 109
in /home/mxiong/public_html/npd/swift/Swift/Errors.php on line 99
Before, I used a Pop before SMTP and the connect worked fine....this was up until the mail server was changed to smtp authentication.
d11wtq was right. It was related to my host provider. I was requested to use a particular port number for using the mail server that I was using. Because of this, my host provider had to open up that port. Once they did that my problem was resolved.