HTML电子邮件偶尔发送源代码 [英] HTML Email occasionally sending source code

查看:196
本文介绍了HTML电子邮件偶尔发送源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的公司,我们有几个客户声称,他们的订单确认电子邮件正在像HTML源一样,没有格式化。然而,我们的大多数客户正在收到他们的电子邮件。



我想我可能已经找到一个链接,这就解释了为什么只有一些客户端收到未格式化的电子邮件,但我不知道的原因。看起来,具有自己的电子邮件地址的自定义域名的用户正在遇到问题和常规电子邮件域,例如 @ gmail.com @icloud。 com 正常工作。



问题是与用户查看电子邮件相关的 ,因为我已经能够复制所有客户端都会显示我的私有域名和源代码问题。



任何想法会是什么原因?



这是我的标题:

  $ headers =From:$ from。\r \\\
;
$ headers。=Reply-To:。$ from。\r\\\
;
$ headers。=Return-Path:。$ from。\r\\\
;
$ headers。=MIME-Version:1.0\\\
;
$ headers。=Content-type:text / html; charset = iso-8859-1;


解决方案

尝试以下标题 HTML 电子邮件...

  $ from = $ from。 '<'。 $从。 >; 
$ headers =MIME-Version:1.0。 \r\\\
;
$ headers。=Content-type:text / html; charset = utf-8。 \r\\\
;
$ headers。='From:'。 $从。 \r\\\
;
$ headers。='Reply-To:'。 $从。 \r\\\
;
$ headers。='返回路径:'。 $从。 \r\\\
;
$ headers。='X-Mailer:PHP /'。 phpversion()。 \r\\\
;
$ headers。='X-Originating-IP:'。 $ _SERVER ['SERVER_ADDR']。 \r\\\
;


At my company, we have had several clients claim that their order confirmation emails are coming through just as the HTML source, not formatted at all. However the majority of our clients are receiving their emails through fine.

I think I may have found a link which explains why only some clients receive the unformatted email, however I'm not sure of the cause. It seems that users with a custom domain name for their email address are experiencing the problems and regular email domains such as @gmail.com or @icloud.com are working fine.

The problem is not related to the client used to view the email as I have been able to replicate the problem with my private domain name and the source code is displayed in all clients.

Any idea what would be the cause of this?

Here are my headers:

$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n"; 
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";

解决方案

Try following headers for HTML Email...

$from = $from . ' <' . $from . '>';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=utf-8" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$headers .= 'Reply-To: ' . $from . "\r\n";
$headers .= 'Return-Path: ' . $from . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'X-Originating-IP: ' . $_SERVER['SERVER_ADDR'] . "\r\n";

这篇关于HTML电子邮件偶尔发送源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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