php Mail()和Outlook [英] php Mail() and Outlook

查看:158
本文介绍了php Mail()和Outlook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

  $ subject =Test Email; 
$ from =noreply@bob.com;
ini_set(sendmail_from,$ from);
$ message =< html>< body bgcolor = \#DCEEFC\>
Hello< br>< br>
这是< b>测试< / b>电子邮件
< br>< br>< hr>
< a href = \\>点击这里< / a>
< br>< br>< hr>
< br>< br>
感谢您的时间,< br>< br>
< / body& ;< / HTML>中;

$ headers =MIME-Version:1.0\r\\\
;
$ headers。=Content-type:text / html\r\\\
;
$ headers。=From:。 $从。 \r\\\
;
mail($ mail,$ subject,$ message,$ headers);

然而,当我发送电子邮件给自己时,我看到Outlook中的所有代码。如果我发送给别人,他们会看到HTML。如果我把它发送到我的hotmail,他们会看到HTML。



这是我的前景(2007)的一个问题,如果是这样,还是我可以做什么电子邮件中的某些内容可以保证正确显示?



请帮助!

解决方案>

我发现问题:



HTML电子邮件不正确显示Godaddy网络邮件



已更改:

  $ headers =MIME-Version:1.0\r\\\
;
$ headers。=Content-type:text / html\r\\\
;
$ headers。=From:。 $从。 \r\\\
;

to:

 code> $ headers =MIME-Version:1.0。 PHP_EOL; 
$ headers。=Content-Type:text / html; charset = ISO-8859-1。 PHP_EOL;
$ headers。=From:Site< $ from> 。 PHP_EOL;

感谢您的所有帮助!
:)


I have the following code:

    $subject = "Test Email";
    $from = "noreply@bob.com";
    ini_set("sendmail_from", $from);
$message = "<html><body bgcolor=\"#DCEEFC\"> 
                Hello<br><br>
                This is a <b>test</b> email.
                <br><br><hr>
                <a href=\"\">Click Here</a>     
                <br><br><hr>
                <br><br>
                Thank you for your time,<br><br>
            </body></html>";

    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html\r\n"; 
    $headers .= "From: " . $from . "\r\n";
    mail($mail, $subject, $message, $headers);

However, when I send the email to myself, I see all the code in Outlook. If i send it to someone else, They see the HTML. If i send it to my hotmail, they see the HTML.

Is this a problem with my outlook (2007), if so, what is it, or can I do something in the email to guarantee it being displayed properly?

Please help!

解决方案

I found the problem:

HTML Email not displaying correctly for Godaddy web based mail

Changed:

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html\r\n"; 
$headers .= "From: " . $from . "\r\n";

to:

$headers  = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL;
$headers .= "From: Site<$from>" . PHP_EOL;

Thanks for all your help guys! :)

这篇关于php Mail()和Outlook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆