Page 1 of 1

Error in remote SMTP mailing

Posted: Mon Mar 02, 2009 3:35 am
by robinp
After successfully sending email from my server using smtp mail option of swift mail
i was trying to send an email using a remote smtp server;
but I got the following error.

Code
****


require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Authenticator/LOGIN.php";

$conn =& new Swift_Connection_SMTP("mail.myremoteserver.com",25);
$conn->setUsername("xxx@myremoteserver.com");
$conn->setPassword("***");
$conn->attachAuthenticator(new Swift_Authenticator_LOGIN());

$swift =& new Swift($conn);


$message =& new Swift_Message("My subject", "My body");

//Now check if Swift actually sends it
if ($swift->send($message, "recepient@someserver.com", "xxx@myremoteserver.com")) echo "Sent";
else echo "Failed";


Error
****


Fatal error:
Uncaught Error of type [swift_connectionexception] with message [The SMTP connection failed to start [mail.myremoteserver.com:25]: fsockopen returned Error Number 110 and Error String 'Connection timed out']
@0 swift::swift() in /home/<MY SERVER PATH>/Swift/test.php on line 42
@1 swift::connect() in /home/<MY SERVER PATH>/Swift/lib/Swift.php on line 112

in /home/<MY SERVER PATH>/Swift/lib/Swift/Errors.php on line 99


can anyone help me?

Re: Error in remote SMTP mailing

Posted: Mon Mar 02, 2009 4:45 am
by Chris Corbyn
The connection is timing out. This is usually down to firewall rules.

Re: Error in remote SMTP mailing

Posted: Mon Mar 02, 2009 4:52 am
by robinp
Thanx for the reply.
Could you please tell where to modify and what to modify in the firewall rules.

Re: Error in remote SMTP mailing

Posted: Mon Mar 02, 2009 5:02 am
by Chris Corbyn
robinp wrote:Thanx for the reply.
Could you please tell where to modify and what to modify in the firewall rules.
Afraid not... it's not a code-level problem, it's system-level.

If this is a shared hosting account, contact your ISP who are hosting the server for you. If you're maintaining the server, double-check that you're connecting to the correct SMTP server since the firewall rules might be on the SMTP server rather than the HTTP server.

Re: Error in remote SMTP mailing

Posted: Mon Mar 02, 2009 6:01 am
by robinp
Hi Chris,
Thanks for the soln.
I will contact the host and check the same.

Robin :D