Page 1 of 1
Page hanging up using mail() with sendmail
Posted: Mon Oct 07, 2002 11:52 am
by sgt_underpants
I know that mail() doesn't return false and I'm looking for a workaround here. I have some users who are getting a white page while the script is waiting for the confirmation from sendmail that the mail was received and sent. Is there any way to avoid this problem of there is no reply? I'm new to PHP and whereas I understand the concepts of mail() I don't know the solution to my problem. Any help would be greatly appreciated.
Okay, so maybe my question was too idiotic to be answered...
Posted: Mon Oct 07, 2002 2:34 pm
by sgt_underpants
...then let me elaborate more. This is what I learned in the WROX book entitled "Beginning PHP4" about the mail() function:
The function returns TRUE when it successfully passes the given mail message to the local mail system. It doesn't care whether the message has actually been sent. Unfortunately, the command doesn't return FALSE on failure - it just doesn't return at all, freezing execution of the script, and meaning the browser simply doesn't receive a response.
Okay, with that said here is my dilemma again. Some users have had this happen when wanting to confirm their order. The page is blank and the lil' icon in the corner just spins round 'n' round.
Here is the code as it is written:
Code: Select all
mail($customer_valuesї'customers_email_address'], EMAIL_TEXT_SUBJECT, $message, 'Content-Type: text/plain; charset="iso-8859-15"' . "\n" . 'Content-Transfer-Encoding: 8bit' . "\n" . 'From: ' . EMAIL_FROM);
// send emails to other people
if (defined('SEND_EXTRA_ORDER_EMAILS_TO')) {
mail(SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $message, 'From: ' . $customer_valuesї'customers_email_address']);
}
// send email to customer service
if (defined('SEND_CS_ORDER_EMAILS_TO')) {
mail(SEND_CS_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $cs_message, 'From: ' . $customer_valuesї'customers_email_address']);
}
What I would like to do is add code that would return the confirmation page even if it doesn't receive a response from the sendmail server. I hope that's a better explanation and that it warrants a response this time.

Posted: Tue Oct 08, 2002 2:56 am
by twigletmac