PDA

View Full Version : PHP mail() issue seems specific to this host.



jccc
11-09-2008, 01:13 AM
Can anyone tell me why the first line here concatenating fields into a message string works, but none of the others will? I've not had this problem on any of several other hosts.


$body = $name . $phone . $email . $besttime . $inquiry;
//$body = $name . ' ' . $phone . ' ' . $email . ' ' . $besttime . ' ' . $inquiry;
//$body = "Name: $name\nPhone: $phone\nEmail: $email\nBest time: $besttime\n\n$inquiry";
//$body = $name . "\n" . $phone . "\n" . $email . "\n" . $besttime . "\n" . $inquiry;

mail($recipient, $subject, $body, $headers)

I do not get any errors (even after setting "error_reporting(E_ALL)"), but simply never receive any messages sent from the form if I use any of the other three ways to create the message body string. The first line above however *does* work and does send messages from the form.

Please note that the first method works even when fields contain spaces, commas, newlines, etc. But for whatever reason, when I concatenate fields as in the other three lines, no email.

jccc
11-09-2008, 01:42 AM
Actually, I see now that this is getting caught in Gmail's spam filter. But that only throws more opaque questions: Why is this happening only when I run the mail script here, and why does it happen only when using the latter three of the four methods for building the message string?

(It think I'm giving up on this.)