Andy Brown
asked on
Problem sending email via PHP
I have a really strange (urgent) issue in relation to sending an email via a php script.
I need to know if the mail() part of this script can send an email to any location (even if it is on another domain). I just setup a test scinearo where I had the php script on our server and had the email sent to me, which worked fine. I then changed the mail address to my clients email address - and the emails didn't get though.
Any ideas?
I need to know if the mail() part of this script can send an email to any location (even if it is on another domain). I just setup a test scinearo where I had the php script on our server and had the email sent to me, which worked fine. I then changed the mail address to my clients email address - and the emails didn't get though.
Any ideas?
<?php
$subject = "TEST: " . $_GET['ID'] . "-" . date("Ymd H:i:s");
mail("test@ourdomain.com",$subject,"", "From: test@ourdomain.com");
header("Refresh: 0; URL=" . $_GET['Hyperlink'] . "");
?>
ASKER
It's odd. When I run the php script on our server it works every time (both your MunterMan's suggestion and our original script). However, when we move it over to the clients side it seems intermittent.
If it is intermittent it is probably timing out due to a connection problem. Also, check the load on the email server to make sure it is not doing anything else while you are trying to send your message.
ASKER
Thanks again for your help.
It's tricky as we are based in the UK and the clients webserver is based in the US (and run via a third party). Also, when we ran the initial tests a few weeks ago it was consistent (and we have other clients using this same script without any issues). Also, something is telling me (although nobody has called me back to confirm), that their server is using Wordpress (and possibly a Wordpress server), which I know was under attack last week - I'm wondering if that might also be the issue.
It's tricky as we are based in the UK and the clients webserver is based in the US (and run via a third party). Also, when we ran the initial tests a few weeks ago it was consistent (and we have other clients using this same script without any issues). Also, something is telling me (although nobody has called me back to confirm), that their server is using Wordpress (and possibly a Wordpress server), which I know was under attack last week - I'm wondering if that might also be the issue.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks MunterMan - I appreciate your help on this one.
if (mail("test@ourdomain.com"
echo " worked ";
else
echo " failed ";