PHP Mail

I’m learning how to send email from PHP and would like your help. I haven’t received any messages from the test code below:

[php]$to = ‘’;
$from = ‘’;
$subject = ‘Test’;
$message = ‘It works!’;

$headers = “From: $from\r\n”;
$headers .= “Reply-To: $from\r\n”;
$headers .= “X-Mailer: PHP/”.phpversion();

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

I gather from other posts that the “from” address must be a DreamHost-hosted domain, and it is.

What am I missing?

It looks correct. You’re correct on the FROM rule, for testing also try sending TO a dreamhost domain. If that works check here and see if your server is RBL’d, the address you would want to enter is

Thank you, LakeRat! I tried having the script’s email come from my Dreamhost email address and go to the same address but did not receive it. I also found no blacklist.

What else might prevent an email from reaching its destination?

Have you tried outputting the mail() function’s result to see if it is getting that far?
For debugging I use this;

[php] if(mail($to, $subject, $email_message, $headers))
echo "Send success: $to
echo "Failed send: $to