2012-10-18 26 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中的任何配置? –