2010-05-17 33 views
1

我使用CodeIgniter的內置庫發送電子郵件。我所要做的就是發送粗體字符串,但不是呈現標記,而是打印它們。我擁有的一切:如何格式化Gmail的電子郵件?

<html> 
<head> 
</head> 
<body> 
<b>Donkey</b> 
</body> 
</html> 

也就是說,秉性,電子郵件我得到。爲什麼不是標籤呈現?

+0

這是否只會導致Gmail出現問題?如果您閱讀Outlook中的電子郵件或Yahoo!郵件,它是否正確渲染? – FrustratedWithFormsDesigner 2010-05-17 18:16:03

+1

可能與發送MIME類型有關...檢查codeigniter庫的api,以切換髮送html版本的方式。 – Kzqai 2010-05-17 18:17:01

回答

5

documentation

$config['protocol'] = 'sendmail'; 
$config['mailpath'] = '/usr/sbin/sendmail'; 
$config['charset'] = 'iso-8859-1'; 
$config['wordwrap'] = TRUE; 
$config['mailtype'] = 'html'; 

$this->email->initialize($config); 

的笨電子郵件類默認爲發送文本電子郵件。除非您指定mailtype爲HTML($config['mailtype'] = 'html';),否則您的html將作爲文本發送出去。

0

你試過

<span style='font-weight: bold'>My bold text</span> 

OR

<strong>another bold tag</strong> 

我們使用這些,它們都適用於Gmail。