I made a PHP script which takes the contents of an HTML form (that the user filled out) and e-mails it twice--one copy to the user who filled it out, and one copy to us (firstname.lastname@example.org).
The problem is, our email (email@example.com) has an auto-responder, and it tries to send out an e-mail to the web site which submitted the form! So every time someone submits the form, we get a copy of the form AND a mail-daemon delivery failure which says something like "cannot send mail to firstname.lastname@example.org".
How can I fix this? Our host doesn't seem to have an "exclusion" option for the auto-responder. Is there something I can do with the headers?
Looks like your 'from' and/or 'reply-to' email addresses weren't configured and the system used a default one.
Look at the php mail function manual here. You can configure those fields within the mail header. E.g.:
<?php $to = 'email@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: firstname.lastname@example.org' . "\r\n" . 'Reply-To: email@example.com' . "\r\n"; mail($to, $subject, $message, $headers); ?>
I've already got those headers :( I also added "Return-Path: firstname.lastname@example.org"
When the e-mail arrives, the From and Reply-To fields look fine, though it does say "mailed-by: web.pas.earthlink.net".
Still, the auto-reply tries to send an e-mail to the actual sender (the server), not who I listed as the sender.
For now, I've marked that particular mail-daemon message as spam, and they've stopped coming, but that doesn't seem like a very good solution...
Anyway, thanks for your help so far!