【问题标题】:How do I format an email for Gmail?如何为 Gmail 格式化电子邮件?
【发布时间】:2011-02-20 13:11:06
【问题描述】:

我正在使用CodeIgniter 的内置库发送电子邮件。我要做的就是发送一个粗体字符串,但不是渲染标签,而是打印它们。我有什么:

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

也就是说,一个字一个字,我收到的电子邮件。为什么标签不渲染?

【问题讨论】:

  • 这只会导致 Gmail 出现问题吗?如果您在 Outlook 或 Yahoo! 中阅读电子邮件邮件,渲染正确吗?
  • 可能与发送 mime 类型有关...检查 codeigniter 库的 api 以了解切换发送 html 版本的方法。

标签: email codeigniter formatting gmail html-email


【解决方案1】:

来自documentation

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

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

CodeIgniter Email 类默认发送文本电子邮件。除非您指定邮件类型为 HTML ($config['mailtype'] = 'html';),否则您的 html 将作为文本发送出去。

【讨论】:

    【解决方案2】:

    你试过了吗

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

    <strong>another bold tag</strong>
    

    ?

    我们使用这些,它们都适用于 Gmail。

    【讨论】:

      猜你喜欢
      • 2019-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多