2012-10-18 25 views
0

我已经使用过使用PHP语言发送电子邮件,并且HTML标记有时不会在gmail帐户中呈现。我已经使用Content Type作为 - charset="iso-8859-1"我附加了图片。HTML标记不在Gmail中呈现 - 使用PHP语言

而且我正在接收消息ID,它不应该在邮件中发送。

enter image description here

+0

您没有足够的声誉上传图片...并请发表您的代码太... – ppeterka

+0

好,谢谢@ppeterka –

回答

2

我不推荐/内置邮件()函数来发送和接收电子邮件使用PHP。使用PHP开源库,如PHPMailer和SwiftMailer。在单独使用mail()时遇到很多问题后,我一直在使用PHPMailer。很容易实现,并具有很多功能。您不必花费宝贵的时间进行电子邮件发送相关的开发。

http://phpmailer.worxware.com/

http://swiftmailer.org/

+0

我可以在kohana框架中使用它吗?因为我只使用kohana框架 –

+0

使用Kohana中的默认模块或使用这些库(它应该工作)。但我没有在我的项目中尝试过Kohana。 –

0

如果HTML不渲染,这通常意味着头部未设置正确。

试试这个:

<?php 
//change this to your email. 
$to = "[email protected]"; 
$from = "[email protected]"; 
$subject = "This is HTML email"; 
$message = " 
    <b>htmlemail....</b> <br> 
    <a href='http://www.google.com'>Google</a>"; 

// To send the HTML mail we need to set the Content-type header. 
$headers = "MIME-Version: 1.0rn"; 
$headers .= "Content-type: text/html; charset=iso-8859-1rn"; 
$headers .= "From: $from\r\n"; 

mail($to, $subject, $message, $headers); 
echo "Message sent.."; 
?> 

http://www.webhostingtalk.com/showthread.php?t=416467

+0

同样的事情,我已经使用@贾斯汀。但没有结果。 –

+0

因此,如果您复制/粘贴上述代码并运行它(仅更改您的电子邮件),它不会显示为HTML电子邮件? – Justin

+0

是@Justin。无论问题是基于SMTP中的任何配置? –