开发者

html in email using php is recieved as pure html code

This is what i have so far

<?php
$_SESSION['name'] = $_POST['name'];
$_SESSION['topic'] = $_POST['topic'];
$_SESSION['message'] = $_POST['message'];
$_SESSION['size'] = $_POST['size'];
$_SESSION['deadline'] = $_POST['deadline'];
$_SESSION['typeformat'] = $_POST['typeformat'];
$_SESSION['stylereport'] = $_POST['stylereport'];
$_SESSION['Head'] = $_POST['Head'];
$_SESSION['edlevel'] = $_POST['edlevel'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['altemail'] = $_POST['altemail'];
$_SESSION['website'] = $_POST['website'];
$subject = $_SESSION['size'] . " no of page(s) " .$_SESSION['deadline'] .  ")";



//------------------email to buyer------------------------------

                            $str='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">';
                            $str=$str.'<html>';
                            $str= $str.'<head>';
                            $str=$str.'<title>Persuasive-essays Order Placed</title>';
                            $str=$str.'</head>';
                            $str=$str.'<body>';
                            $str="<TABLE cellSpacing=0 cellPadding=0 align=center border=1><TR><TD align=left valign=top><font face='Verdana, Arial, Helvetica, sans-serif' color='#000000' size=2>Name</font></TD><TD colSpan=2><font face='Verdana, Arial, Helvetica, sans-serif' color='#000000' size='1'>".$_SESSION['name']."</font></TD></TR>";
//$strBody="good".$strBody;
$str=$str."<TR><TD >Topic</FONT></TD>";
$str=$str."<TD colSpan=2 align=left valign=top><font face='Verdana, Arial, Helvetica, sans-serif' color='#000000' size='1'>".$_SESSION['topic']."</font></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Detail of Topic</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><div align=justify><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>".$_SESSION['message']."</FONT></div></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Broad Category</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>".$_SESSION['Head']."</FONT></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Your Educational Level</FONT></TD>";
        $str=$str."<TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>".$_SESSION['edlevel']."</font></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Number of Pages</FONT></TD>";
        $str=$str."<TD align=left valign=top colSpan=2><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>".$_SESSION['size']." page(s) </font></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Dead Line</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>".$_SESSION['deadline'].")</font></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Type/Format</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>Essays</font></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 siz开发者_运维技巧e=2>Style of Report / Style of Citation</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=1>".$_SESSION['stylereport']."</font></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Your Email</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2><a href='mailto:".$_SESSION['email']."'>".$_SESSION['email']."</a></TD></TR>";
        $str=$str."<TR><TD align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2>Alternate Email</FONT></TD>";
        $str=$str."<TD colSpan=2 align=left valign=top><FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000000 size=2><a href='mailto:".$_SESSION['altemail']."'>".$_SESSION['altemail']."</a></TD></TR>";
        $str=$str."<TR><TD colSpan=3></TD></TR></TABLE>";
        $str=$str."</TABLE>";
                            $str=$str."</span></a>";
                            $str = $str."<br>";

                            $str=$str.'</body>';
                            $str=$str.'</html>';

                                                    $headers  = 'MIME-Version: 1.0' . "\r\n";
                                                    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                                                    $headers .= "From: order@persuasive-essays.com";
    echo $_SESSION['email'];
                                                    echo $str;  
                echo mail($_SESSION['email'],$subject,$str,$headers);

   ?>

When i run program i get email in my account but the body is html ....the code is not getting translated...can anyone help. Thanks


  1. Save the message as a local HTML file and check the syntax of it. Is it valid by itself?
  2. Add newlines to the end of the lines:

    $str .= "<table ..."."\r\n";
    $str .= " ..."."\r\n";
    // ...
    

    Normally lines in the message parameter of the PHP Mail function must be 70 characters at most.

  3. Try to use a well-established PHP mail library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜