Jeff 5

Hi folks,

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 (

The problem is, our email ( 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".

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?

Thanks! Jeff

  • Hey Jeff, you could probably find an answer more readily at, a site similar to this one, but more geared toward programming than CSS/Markup/Design. Zack Doherty about 7 years ago

3 answers

o.k.w 2355

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.:

$to      = '';
$subject = 'the subject';
$message = 'hello';
$headers = 'From:' . "\r\n" .
    'Reply-To:' . "\r\n";

mail($to, $subject, $message, $headers);
Answered over 7 years ago by o.k.w
Jeff 5

I've already got those headers :( I also added "Return-Path:"

When the e-mail arrives, the From and Reply-To fields look fine, though it does say "mailed-by:".

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!

Answered over 7 years ago by Jeff
  • Hm.. weird indeed. Perhaps the problem lies with the autoresponder? o.k.w over 7 years ago
salsan 0

Thanks for useful information. I would try it. I want to add form builder as a nice tool for creating any forms on your web site.

Answered about 7 years ago by salsan