开发者

in php, how to send the html tag to mail

<script type="text/javascript">
var head= 23;
</script>

<?php
$h="<script language='javascript'> document.write(head);</script>";

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

 $mail_from='summa@yy.co.in';
 $name="husssain";
 $headers.="From: $name <$mail_from>";
 $con="Welcome to world";
 $to ="aaaa@gmail.com";
 $send_contact = mail($to,$con,$h,$headers); 
?>

t开发者_运维技巧hen i send the $h to my mail id but i recieve only this <script language='javascript'> document.write(head);</script>


Consider output buffering. Better yet, consider designing your script so that the contents of the message come from a proper template.

And you realize that JavaScript is highly unlikely to run within a received email, right?


Programatically, you can't do that.

The PHP code renders before the Javascript on the page. In short, the PHP is handled first then the Javascript is written to the page. You need to have the Javascript send to a page or use AJAX to call a mail page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜