[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

Problem in Sending Email Format

In ASP I use a code for sending Email in HTML format. The ASP code are as follows :
===================
details="<html><body><table bgcolor=#ffffff>"
for Field = 4 To Request.Form.Count
details=details & "<tr><td><B>" & Request.Form.key(Field) & "</B></td><td><B>&nbsp:&nbsp</B></td><td>" & Request.Form(Field) & "</td></tr>"
next
details=details & "</table></body></html>"
set Mailer = Server.CreateObject("Persits.MailSender")Mailer.Host = Request.Form("HostSMTP")
Mailer.From = Request.Form("Email1")
Mailer.AddAddress "order@niwell.com"
Mailer.Subject = Request.Form("Subject")
Mailer.IsHTML = true
Mailer.Body = details
Mailer.Send
set Mailer = Nothing
=========================
This code send an email in this format :
==========================
Domain_Name  :  bubai
Extension  :  .name
Renewal_Period  :  7
Contact_Name  :  Subhasish Nag
Company  :  Nag Enterprises
Phone  :  25855465
Email1  :  bubai_nag@indiatimes.com
Email2  :  
=========================

But I face a problem when I send the same email in PHP. The PHP code are as follows :
**********************************
$details="<html><body><table bgcolor='#ffffff'>";
foreach($_POST as $key => $value)
{
$details.="<tr><td><b>".$key."</b></td><td><b>&nbsp;&nbsp;</b></td><td>".$value."</td></tr>";
}
$details.="</table></body></html>";
$to="backoffice@niwell.com";
$subject=$HTTP_POST_VARS["subject"];
$from=$HTTP_POST_VARS["Email1"];
$headers="From: $from\r\n";
$headers.= "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to,$subject,$details,$headers);
*******************************

But this code send an email in this format :
**********************************
<html><body><table bgcolor='#ffffff'><tr><td><b>subject</b></td><td><b>&nbsp;&nbsp;</b></td><td>CC - Domain Registration</td></tr><tr><td><b>redirect</b></td><td><b>&nbsp;&nbsp;</b></td><td>http://www.hostmac.com/cccart-redirect.htm</td></tr><tr><td><b>Domain_Name</b></t.............
************************************
Why the email send in this format ? There are any wrong in my PHP code. I want the email send the above ASP coded email format. Please short out this problem as soon as possible. It is very urgent
0
bubai_nag
Asked:
bubai_nag
1 Solution
 
masirofCommented:
Looks like you are trying to write HTML in HTML. Remove your <html><body> tags and try again.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now