0

I am running a local apache server on an ubuntu machine, and i am trying to use the phpmailer class to send mail. It tries to connect by fsockopen to the mail server, but it throws a timeout error. I tried setting the timeout to 15sec with no luck. It does work on other machines.

How can i find out if my ISP has blocked requests ? The mail server responds to ping.

4
  • What mail server are you connecting to? Most residential ISPs disallow outgoing port 25 connections to any server other than their own. Try changing the outgoing server to be your ISP's SMTP server. Commented Sep 10, 2009 at 15:18
  • Are you able to use an MUA (thunderbird/outlook/mail.app) to send emails through it? Commented Sep 15, 2009 at 2:17
  • 1
    I had this problem with fsockopen where the host had multiple IPs. I could telnet/swaks to the same hostname no problem, but fsockopen always timed out. By using gethostfromname() and then using the IP directly, fsockopen was much happier and did not time out. Very strange. Commented Dec 11, 2014 at 10:48
  • check it out here codingbin.com/connection-timeout-error-php Commented Jun 7, 2017 at 7:16

1 Answer 1

2

ping and SMTP command don't go via the same port ; it is possible that one port is opened, and not the other one.

If there is a timeout, it probably means that :

  • either your SMTP server is not accepting connections from your server
  • or there is something somewhere (like a firewall) that's blocking your requests.

If you have an ssh access to the server, using telnet in command line to try to connect to the SMTP server, and send SMTP commands, might allow you to get some more informations...

Here a couple of links that show examples of an SMTP session via telnet :

If you cannot connect to the server, maybe you'll get some error message (telling you that you are not allowed to connect, for instance), or it'll timeout again... Which probably means your request are being blocked somewhere...

In that case, check with your network administrator ; maybe he'll have some idea about opening some port on the firewall.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.