【问题标题】:HTML email (from SendGrid) not being rendered properlyHTML 电子邮件(来自 SendGrid)未正确呈现
【发布时间】:2017-03-06 11:25:56
【问题描述】:

SendGrid 默认在 header 中设置什么 Content-Type? 我有一个问题,即通过 Sendgrid 发送的 html 电子邮件格式不正确。
在我看到的电子邮件标题中

MIME-Version: 1.0
Content-Type: text/plain

然后在任何电子邮件客户端中呈现以下内容,无论是独立的还是基于 Web 的。

This is a multi-part message in MIME format.
--------------e21a5bffb444e61b8e8a30240210d506
Content-Type: text/html; charset=UTF-8; format=flowed
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

等等等等

标题中的 Content-type 是否应该是 multipart/mixed 或类似以正确呈现 html 和显示图像? 这是如何改变的?
可以通过发送到 SendGrid 的服务器的实际 html 以某种方式更改它吗?
任何反馈表示赞赏!

【问题讨论】:

标签: html email content-type sendgrid


【解决方案1】:

您正在使用的库将content-type 硬编码为text/plain。在第 135 行的 smtp/mailer/SMTPMailer.as 源代码中:

writeUTFBytes ("Content-Type: text/html; charset=UTF-8; format=flowed\r\n");

这个库看起来不是非常健壮,它缺乏文档,而且它已经 6 岁了。您可能想尝试寻找不同的解决方案。

【讨论】:

    猜你喜欢
    • 2018-04-18
    • 2022-01-24
    • 2020-08-01
    • 2011-10-28
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多