I hoping someone will be able to help me, as I'm at a loss as to what is causing the problem.
Our website has a contact us form, with fields for name, email, kid name, kid ID, & message.
When the form submits, the server side php code validates the form fields, & if all is good, uses the built in php mail() function to send 2 emails.
Email 1 goes to an inbox on a hosted exchange server containing the values in the form fields.
Email 2 goes to the person submitting the form saying thanks - we'll get back to you shortly.
For email 1, the From, Reply-To, & Return-Path headers are set to the email entered in the form, & the To param in the mail() function is the email address of the inbox of the hosted exchange server.
For email 2, the From, Reply-To, & Return-Path headers are set to the email address of the inbox on the hosted exchange server, & the To param in the mail() function is the email address entered in the form.
The website's host has the MX, PTR, SPF, & TXT records set up properly to allow emails to be sent to & from the email address of the inbox of the hosted exchange server.
The website's host uses QMail as the SMTP service that actually sends the emails, & in all tests, QMail is receiving a success when sending both email 1 & 2. There is no error issued by the mail() function.
Local tests were done with IE8, Chrome, & FF3.6.17. The code was not changed between tests showing this problem.
In all test cases, email 2 (back to the person submitting the form) is sent just fine.
Email 1, on the other hand, is only intermittently working. The general pattern is that the 1st time the contact form is used with each distinct email address in the form, the email is sent fine, & the headers & to are correct.
The 2nd time the contact form is used with a previously used email address in the form, the To param is set to the email address in the form, the headers are all blank, & in spite of the To email address being incorrect, the email is not received.
The website's host's support staff may have found another potential symptom, which is that after clearing cookies, all the email 2's got through ok. However, the page does not use any cookies in relation to the form.
Lastly, I tried again a while (30 mins?) after email 2's weren't getting through, then another try worked, after which the email 2's screwed up as described above again.
Is there a known bug with php's mail() function along these lines? Is there a maximum frequency at which mail() can be used?
I'm at a loss as to why the code sometimes works, & sometimes doesn't. The website's host's staff are at a loss, as well.
Trying to google this issue seems to turn up forums of people saying to use different modules (Swift Mailer, PHPMailer, Pear Mail, etc.), but as the website is live, I'm wary that rebuilding the automated emailing code will introduce errors beyond the one described above.