views:

542

answers:

3

I have a script that uses PHPMailer to send out an email. The email is sent with a direct SMTP connection to a remote mail server. The problem is that while everything seems to be okay when I run the script on my local machine, when the script is run on our live site using the same remote SMTP server the email never gets through. What's curious is that it seems to have worked at one point in time and has semi-recently decided that it just wasn't going to work anymore.

What potential points of failure are there? I do not have access to the SMTP server in question so I can't check its log files without submitting a support ticket, and although I was just given sudo access to the web server that is sending the email, I'm not quite sure what I'm looking for in terms of logfiles to go through, etc.

FWIW, my local machine is running Ubuntu 8.10, and the remote machine is running Red Hat Enterprise Linux ES release 4 (Nahant Update 1), so there is a bit of a difference in versions, but all I'm really looking for is a few pointers on where I should be looking for problems.

A: 

Is the remote machine behind a firewall? If it is, it might block the sending of e-mails. Or your SMTP server is disallowing access from the remote server.

Daniel A. White
+1  A: 

How about you log into your live site, try to open a raw session to the remote SMTP server, and attempt to send email using raw SMTP commands? Doing so will help narrow down the possible causes of the problem.

ayaz
Thanks for your advice. This led to me finding a severe latency problem between the web server and SMTP server (didn't know about before because I couldn't ping the machine), that I believe might be causing the problem.
AlexMax
You are welcome, AlexMax! Here's hoping you are able to work around the problem.
ayaz
A: 
  • Is the machine behind a firewall?
  • Is the SMTP server configured to block certain hosts, or to only allow certain hosts?
  • Does the SMTP server require authentication for only certain networks?

You should look into debugging PHPMailer, it should be able to provide the raw SMTP requests and responses that you can look at to see if anything is going wrong.

Keith Palmer