PDA

View Full Version : From header incorrectly sent



bluemonkey
21-Jul-2006, 06:01 PM
For those of you hosted on an apache server running php5.x you may have discovered your forms disappearing down a black whole, even though the form mailer successfully process your form.

This is because PHP FormMail fails to send the "From" field in the header correctly. Basically, Apache sends the email as anonymous@public.mydomain.co.uk whereas it should read my.email@domain.co.uk

Firstly you may have to turn php safe_mode to off, though if your running php5 don't worry too much.

Secondly, find line 3111 (around there somewhere) and change
return (mail($s_to,$s_subject,$s_mesg,ExpandMailHeaders($a_headers))); to
return (mail($s_to,$s_subject,$s_mesg,ExpandMailHeaders($a_headers), "-fmy.email@domain.co.uk"));
This is only an issue if your server/email server is exceptionally "strict"?

[Sorry, this should have been titled: send correct "from" header]

russellr
21-Jul-2006, 09:04 PM
Hi,

Thanks for posting this information, however, it does need some correction.

The need for the "-f" option is dependent on the mail server and not really anything to do with PHP 5 or Apache.

FormMail already supports this "-f" requirement.

You simply set SENDMAIL_F_OPTION to true in FormMail's configuration section.

Some servers impose further restrictions - they insist that the sender of the email is from the originating domain. For alert messages you set $FROM_USER. For form results you add the "mail_options" hidden field and specify "FromAddr".

In general, it's best to avoid making changes to FormMail outside its configuration section.