开发者

Why are some PHP email bodies containing the surrounding html code and other are not? And that is not PHPMailer

I have various emails being sent out via PHP mail. The problem is, for example when I receive the email, it is displayed in the body properly without any surrounding html. For some reason, other people that I am testing it out with are getting it with the html showing up.

Here is an example of one of the emails being sent:

        $Email = $result['Email'];
        $check_profi = $result['check_profi'];
        $check_reply = $result['check_reply'];

        if($prof->id != $auth->id && $check_profi == 'checked') {

        $to = $Email;
        $subject = "$auth->first_name $auth->last_name left you a comment on Blah.com";
        $message = "$auth->first_name $auth->last_name left you a comment on Blah.com: <br /><br />\"$body\"<br /><br /> <a href='http://www.Blah.com.php?id=" . $prof->id . "'>Click here to view</a><br /><br />Do LIFE,<br />";
        $from = "Blah <noreply@开发者_如何学PythonBlah.org>";
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= "From: $from";
        mail($to, $subject, $message, $headers);
    }

I have been suggested PHP mailer but that is a huge way around something simple I need to do. I already have my mail all set up and it works great,except this small issue.


Perhaps you're forgetting some necesary headers. Normally I use an specific mail library to avoid these issues, like PHPMailer ( http://sourceforge.net/projects/phpmailer/ )


Those who see the HTML probably don't have readers supporting HTML email. Trying including a plaintext alternative.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜