You are here: headers problem in PHP « All PHP « IT news, forums, messages
headers problem in PHP

Posted by glynnjwilliams on 06/23/06 15:29

Hi I'm having a problem with the following code:

<?
if (isset($_REQUEST['Submitted']))
{
// $mailto - set to the email address you want the form sent to,
$to = 'me@mydomain.com';

// $subject - set to the Subject line of the email
$subject = "Contact Form";

$headers = "MIME-Version: 1.0\r\n";//for html
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$Name = $_POST['Name'];
$MembershipNumber = $_POST['MembershipNumber'];
$Email = $_POST['Email'];
$EmailVerify = $_POST['EmailVerify'];
$Enquiry = $_POST['Enquiry'];
$message = "<p>Hi, <strong>".$Name."</strong> has emailed you</p>
<p>Membership Number: <strong>".$MembershipNumber."</strong></p>
<p>email Address: <strong>".$Email."</strong>
<p>They have left the following message:</p>
<p><strong>".$Enquiry."</strong></p>";

if(mail($to, $subject, $headers, $message, "From: \"$Name\"
<$Email>\nReply-To: \"$Name\" <$Email>\nX-Mailer: chfeedback.php
2.01"));
{
header("Location: index.php");
exit ;
}
}
?>

When I remove the two headers:

$headers = "MIME-Version: 1.0\r\n";//for html
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

and also the $headers from the mail part of the code it sends fine.
APART from the formating is removed from the email!

Is there a way of getting this code to work and include the formatting?

FYI: It used to work before I put the "From: \"$Name\"
<$Email>\nReply-To: \"$Name\" <$Email>\nX-Mailer: chfeedback.php 2.01"
into the mail command. I need this as the client requested it because
the email was coming in as nobody@......

Cheers
Glynn

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация