nickdrums Posted February 1, 2008 Share Posted February 1, 2008 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 = 'nick@cole2.com'; $headers['From'] = 'nick@drumsense.com'; $headers['To'] = 'nick@cole2.com'; $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. Quote Link to comment Share on other sites More sharing options...
Cep Posted February 1, 2008 Share Posted February 1, 2008 The answer is fairly simple pipex is not an open relay, you need to pass the email to a client program or a mail server authorised to relay mail to pipex. Quote Link to comment Share on other sites More sharing options...
nickdrums Posted February 4, 2008 Author Share Posted February 4, 2008 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. Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted February 4, 2008 Share Posted February 4, 2008 Just because your connection was accepted doesn't mean it will relay mail for you. Quote Link to comment Share on other sites More sharing options...
nickdrums Posted February 4, 2008 Author Share Posted February 4, 2008 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! Quote Link to comment Share on other sites More sharing options...
Cep Posted February 5, 2008 Share Posted February 5, 2008 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. Quote Link to comment Share on other sites More sharing options...
nickdrums Posted February 5, 2008 Author Share Posted February 5, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.