Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Why would it work, and then not work?

8:37 pm on Jun 3, 2008 (gmt 0)

New User

5+ Year Member

joined:May 21, 2008
posts: 6
votes: 0

Hello all. Recently I put together some code that sends a form to an email address, and then another email address that is provided in the form. It was all working perfectly, for about a week until today when suddenly it does not work. NO CHANGES HAVE BEEN MADE to these files, they haven't been touched since my final check when it worked fine.

Any ideas as to why this could happen?

9:06 pm on June 3, 2008 (gmt 0)

Senior Member

joined:Nov 12, 2005
votes: 0

Has your server undergone any changes recently? Are you sure you just aren't finding the emails and they didn't wind up in a bulk folder or were just omitted entirely.

If the script hasn't changed, something else has.

9:03 am on June 4, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 4, 2005
votes: 0

$emails = array("email1","email2");

foreach ($emails as $email)

mail($headers, $subject, $message);


Check your code again...might be something silly lying around you didn't notice at first.

If not, ask your hosts if anything has changed on their side.

1:07 pm on June 4, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 28, 2002
votes: 0

suddenly it does not work

Oh, well, where is my crystal ball when I really need it?

- how are you sending the mail -- using the mail() function?
- what is the return status of the mail() function (TRUE or FALSE)?
- what is in the web server's error_log?
- what changed in the web server config?
- what changed in the PHP config?
- what changed in the sending mail server?
- has your form been abused by spammers and the mail server admin decided to no longer relay your mails?
- what changed elsewhere in the sending system?
- what changed in the recipient's mail server?
- are new anti-spam rules in effect in the receiving server?
- is the sending mail server blacklisted on a DNSBL that is used by the receiving system for filtering?
- did you sent the mail with a valid return address to see a bounce?
- what is the bounce message then, if there is any?
- what changed at the receiving mail client?
- are new anti-spam rules in effect at the client?
- has the mail been mislaid at the client's end (perhaps it is in the spam folder, if there is any).

This list may be incomplete, though.
But as long as you don't give another hint on what part may "not work", it is hard to tell anything ....

Kind regards,

1:46 pm on June 4, 2008 (gmt 0)

New User

5+ Year Member

joined:May 21, 2008
posts: 6
votes: 0

Heres some info that may help, i am sending the mail using the mail() function
We have our own server here, and my boss said that absolutely nothing has changed, and that I am the only person that could have changed anything (the only thing that has changed is that I added some things to the FTP site thinger, none of which are named anything remotely close to the two files in use by the form). There are no errors returned, after submitting the form, it shows my confirmation page. My form has not been abused, or used by anyone except myself, and the technicians that need it. The address of the sender is receiptghost@example.com, example.com is the same name that the receiving address uses which is receipts@example.com. We have checked the spam folder many times and we have not found a single one, however occasionally a form will get mailed through when I test it.

my mail function looks like this:

mail("receipts@example.com".$CustomerEmail, "Service Receipt",
$MailBody, "From: receiptghost@example.com\r\n".'Content-type: text/html; charset=iso-8859-1' . "\r\n");
header( "Location: confirmation.html" );

The form still shows up on the site, and after submitting I get my confirmation page. This entire system was operational early last week when I made the final changes to it and tested to it.
If you would like I could provide a link to the site itself, or post my code.

4:18 pm on June 4, 2008 (gmt 0)

New User

5+ Year Member

joined:May 21, 2008
posts: 6
votes: 0

Another question, when the email is sent from filling out the form, what exactly sends it?

Meaning, the name receiptghost@example.com shows up, but where is it actually being sent from?

4:13 pm on June 6, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 28, 2002
votes: 0

what exactly sends it?

The mail() function passes its parameters to the definied mail handler on the host system. On a unix system, the mailer binary (sendmail or a substitute) is started, on a windows system, the mail() function talks to a running MTA through a network socket.
And it sends what you specify to appear in the To: / Text / Subject: / and other headers.

I would start with a simple test case with hand coded fields to test the basic mail path functionality.
The '"receipts@example.com".$CustomerEmail' looks strange unless we know what is in $CustomerEmail ?

Make sure that the From: address is a valid address to receive and see technical bounce messages from the mail system(s).

And a I would wrap the mail() to get its status:
if (mail(...)) { echo 'mail() passed';}
else {echo 'something went wrong in mail()';}
Depending on that status you may get a hint if there may be something wrong in the way your program works, or further down the chain beyond your program.

Kind regards,


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members