Forum Moderators: coopster
I have created a Feedback Form in php. It is working, but when email gets It display the boundary at the bottom of mail
i.e. "----=_NextPart_000_0004_01C85371.053AD250";
My php code is as follows :
<?php
$WebsiteUrl= getenv('HTTP_REFERER');
if (!empty($WebsiteUrl))
{
$Website= split("/",$WebsiteUrl);
$Ip = @gethostbyname($Website[2]);
if (substr($Website[2],0,4)=="www.")
{
$ref_url = $Website[2];//--- Domain Name ---
}
else
{
$ref_url = "www.".$Website[2];
}
//--- ' Check whether It has Come from Our Serevr Or Not.
if(($Ip == "203.199.x.x")¦¦($ref_url=="www.example1.com") ¦¦ ($ref_url=="example1.com"))
{
include("feedbackphp.html");
$form_fields = array_keys($HTTP_POST_VARS);
for ($i = 0; $i < sizeof($form_fields); $i++)
{
$thisField = $form_fields[$i];
$thisValue = $HTTP_POST_VARS[$thisField];
$MailBody = str_replace("{".$thisField."}",$thisValue,$MailBody);
$MailtxtBody = str_replace("{".$thisField."}",$thisValue,$MailtxtBody);
}
$emailsubject = "$_POST[subject]";
$recipient = "$_POST[recipient]";
$from = "$_POST[from]";
$emailfromname = "$_POST[contact_person]";
$emailto = "$recipient";
$emailfromaddr = "$from";
$emailsubject = "$emailsubject";
$boundary = "----=_NextPart_000_0004_01C85371.053AD250";
$emailheaders = "From: $emailfromname <$emailfromaddr>\n";
$emailheaders.= "To: $emailto\n";
$emailheaders.= "Reply-To: $emailfromaddr\n";
$emailheaders.= "Bcc: enquiry@example2.com\n";
$emailheaders.= "Content-Type: multipart/alternative;\n\tboundary=\"".$boundary."\"\n";
$emailheaders.= "X-Priority: 3\n\n\n"; // Urgent message!
$emailbody .= "--$boundary\nContent-Type: text/plain;\n\tcharset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\n";
$emailbody .= $MailtxtBody;
$emailbody .= "\n\n";
$emailbody .= "--$boundary\nContent-Type: text/html;\n\tcharset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\n";
//here the email body is inserted
$emailbody .="\n".$MailBody."\n\n\n\n".$boundary."\n\n";
// send actual mail
$mail_status = mail($emailto , $emailsubject , $emailbody , $emailheaders);
//echo $emailheaders;
//echo $emailbody;
}
?>
<META HTTP-EQUIV=Refresh CONTENT="35; URL='http://<?=$Website[2]?>'">
<body>
<div align="center">
<center>
<table border="2" cellpadding="0" cellspacing="0" width="698" height="278" bordercolorlight="#000080" bordercolordark="#000080">
<tr>
<td valign="middle" height="276" bgcolor="#FFFFCC" width="692">
<hr width="650">
<div align="center">
<table border="3" cellpadding="0" cellspacing="0" width="107" bordercolorlight="#000080" bordercolordark="#000080">
<tr>
<td>
<p align="center"><img border="1" src="aemail.gif" width="107" height="35"></td>
</tr>
</table>
</div>
<p align="center"><font face="Times New Roman"><font size="5">Your
Enquiry Has Been Sent </font><font size="4"><br>
</font><b><i><font size="5" color="#DA0E03">Successfully!</font></i></b></font></p>
<hr width="650">
<p align="center"><font color="#000080" size="1" face="Verdana">Now you
are being redirected to Homepage of <b><?=$Website[2]?></b></font></td>
</tr>
</table>
</center>
</div>
<p align="center"> </p>
<p align="center"> </p>
</body>
<?
}
?>
[edited by: jatar_k at 6:57 pm (utc) on Jan. 28, 2008]
[edit reason] please use example.com [/edit]