Page 1 of 1

Simple mail() question

Posted: Wed Aug 27, 2008 8:59 am
by Skara

Code: Select all

error_reporting(E_ALL);
 
$to = 'example@gmail.com';
$headers = "From: no-reply@example.com\r\nReply-To: no-reply@example.com\r\n";
 
if (mail($to,'test','testing',$headers)) echo 'ok';
Am I doing something incredibly stupid? The output I get is 'ok.' No error messages. It doesn't work. I get no email. My host (retarted people) says that there's a problem with my code. Am I crazy or are they?

Thanks.

Re: Simple mail() question

Posted: Wed Aug 27, 2008 9:16 am
by Chalks
when you email to gmail accounts, you need to end your headers with "\r\n\n" otherwise, the headers end up in the message body. Other than that, looks fine to me.

Re: Simple mail() question

Posted: Wed Aug 27, 2008 11:27 am
by Skara
Thanks. I didn't think I was crazy, but it's nice to be told that.