PHP mail() and AutoResponders
Posted on 27 January 2004 11:58 PM
I have set up an email form that uses the PHP function mail() to send a message to an auto-responder with the intention that the auto-responder would respond to the form's poster ($email).
This is not happening. The php script sends the mail properly and the auto-responder works from the CNC set-up page correctly.
PHP mail(): mail("firstname.lastname@example.org","Request for product information",$message,"From:$email\r\n")
What am I missing?
The PHP mail() function does not allow you to override the true Sender, or SMTP Sender. The SMTP Sender is the email address that the mail system sees as sending the email and may not be identical with the From header in the email message.
Email sent with the PHP mail() function has the SMTP Sender set by the system to PHP@YOURDOMAIN (where YOURDOMAIN is, of course, your own domain name). You can see this by inspecting the message headers and noting that, for mail delivered to a FutureQuest® account, the FutureQuest® mail system records the SMTP Sender in the Return-Path header of the email message.
Although you can add a From header that is displayed to the recipient, the autoresponder script uses the SMTP Sender (Return-Path), which is PHP@YOURDOMAIN.
The best way to accomplish what you are trying to do would be to simply have the PHP script mail the text to the user rather than bouncing it through an autoresponder first.