Jump to content

SMTP Conection Refused


nickdrums

Recommended Posts

Hi all,

 

Trying to use PEAR Mail class to send emails via my ISP's SMTP server, but each time I get the following error:

 

Failed to connect to smtp.dsl.pipex.com:25 [sMTP: Failed to connect socket: Connection refused (code: -1, response: )]

 

Here is the code I am using:

 

require_once("Mail.php");

 

$recipients = '[email protected]';

 

$headers['From'] = '[email protected]';

$headers['To'] = '[email protected]';

$headers['Subject'] = 'Test message';

 

$body = 'Test message';

 

$params['host'] = "smtp.dsl.pipex.com";

$params['port'] = 25;

$params['auth'] = false;

$params['debug'] = false;

$params['username'] = "***";

$params['password'] = "***";

 

// Create the mail object using the Mail::factory method

$mail_object = Mail::factory('smtp',$params);

 

$send = $mail_object->send($recipients, $headers, $body);

 

if (PEAR::isError($send)) {

print($send->getMessage());

} else {

echo("Email sent successfully");

}

 

Really appreciate any suggestions on how to avoid this, or at least move forwards!!

 

Nick.

Link to comment
https://forums.phpfreaks.com/topic/88852-smtp-conection-refused/
Share on other sites

Thanks for your reply Cep, but sorry I don't understand!

 

Can you expand a bit on what you mean by the suggestions you make? How would I go about them?

 

As an addendum, I've since tried the following from my windows machine here:

 

c:\> telnet

telnet> open smtp.dsl.pipex.com 25 which elicits the following response:

 

220 blaster.systems.pipex.net ESMTP Postfix

 

Which suggests to me that the server does not fundamentally object to contact via port 25 ...

 

Help! Nick.

Hmm - so how do I get it to do this? Or am I banging my head against a wall here?

 

Incidentally, I'm trying to get this to work as my website is hosted at 1&1, and Hotmail and others have decided to reject any emails from the 1&1 mail servers as an anti-spam measure. I'm trying to send my customers emails and they are bouncing back. The answer seems to be to add an SPF record to my DNS, but the 1&1 domain management interface does not allow this, and 1&1 will not do it for me.

 

Grr!

Your not going to get around this. Pipex will not let you use their servers to relay mail. This is to prevent spammers/viruses from using their servers. If you hold a business account with Pipex you can purchase an IP block from them and then you will be given access to their mail relay.

Thanks again Cep - I do have a consumer broadband account with Pipex, which is why I'm trying to use that SMTP server, and indeed I have switched to that one on my email client on my machine here. What is it about the connection to the SMTP server from php running on the hosted server that leads to the Connection Refused?

 

Nick.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.