Email form questions
Posted: Wed Sep 13, 2006 8:51 pm
Hi,
I'm using the attached PHP mail fuction for an email form on my site that retrieves variables from a Flash .swf file. The code works and emails are sent, but I know the code could be improved. For example, my web host says that I need to use the following FROM syntax within the Mail () function: "-fuser@domain.com". I'm not doing this at the moment as when I try to do this the email I receive includes within its actual message the text: -fdonotreply@stpatrickscommunity.org
Reply-To:
X-Mailer: PHP/4.4.1
Also at php.net it suggests adding the following code in order to stop mail providers such as Hotmail marking the php-generated e-mails as spam.I don't understand where to include this line of code. It's important that my code is Hotmail friendly as the email is being sent to an email address that subsequently forwards to my Hotmail account.
Any help would be greatly appreciated. I'm anxious that this mail function is as good as it can be.
Many thanks,
Leo
I'm using the attached PHP mail fuction for an email form on my site that retrieves variables from a Flash .swf file. The code works and emails are sent, but I know the code could be improved. For example, my web host says that I need to use the following FROM syntax within the Mail () function: "-fuser@domain.com". I'm not doing this at the moment as when I try to do this the email I receive includes within its actual message the text: -fdonotreply@stpatrickscommunity.org
Reply-To:
X-Mailer: PHP/4.4.1
Also at php.net it suggests adding the following code in order to stop mail providers such as Hotmail marking the php-generated e-mails as spam.
Code: Select all
'Return-Path: ' . $sender_address . "\n"Any help would be greatly appreciated. I'm anxious that this mail function is as good as it can be.
Many thanks,
Leo
Code: Select all
<?
$to = 'donotreply@stpatrickscommunity.org';
$subject = 'Message for the St. Patricks Community';
$body = "You have received a message via the St. Patrick's Community website. The details of the message are listed below...\n\nName: $name\nEmail: $email\n\nMessage: $message";
$body = wordwrap($body, 70);
$headers = 'From: donotreply@stpatrickscommunity.org' . "\r\n" .
"Reply-To: $email" . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $body, $headers);
?>