我已经尝试了几周转换纯文本电子邮件,并使用Mandrill将转换后的HTML插入到模板中。我可以使用规则引擎将纯文本电子邮件转换为HTML。我还可以使用规则引擎将HTML插入到模板中。但是,我似乎无法做到这两点。
我正在使用此模板:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Andrew College</title>
</head>
<body style="background: #F4F4F4;">
<div style="max-width:600px; margin: 0 auto; padding-top:20px;">
<a href="http://solutionguard.com" target="_blank"><img src="https://www.andrewcollege.edu/sites/default/files/attachments/aclogo.png" style="padding: 10px 0px; max-width: 50%; height: auto;" alt="Andrew College"/></a>
</div>
<div style="max-width:600px; margin-left: auto; margin-right: auto; background:#ffffff; padding: 10px 10px 10px 10px; border: 1px solid #cfcfcf;">
<span mc:edit="main" style="text-align:left; font-family:sans-serif; font-size: 16px; line-height: 150%;">Some sample text.</span>
</div>
<p style="text-align:center; font-family: sans-serif; font-size:13px; line-height:150%">© <a href="https://andrewcollege.edu" target="_blank">Andrew College</a>
</p>
</body>
</html>
规则引擎设置:
但是,最终的电子邮件仅显示空白模板。使用Gmail的“显示原始内容”功能会产生以下结果:
Content-Type: multipart/alternative; boundary="_av-zlN5SA0dJJ8qF-AJlRIGAg"
--_av-zlN5SA0dJJ8qF-AJlRIGAg
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
This is a test of the HTML template.
Thanks,
Bob User
--_av-zlN5SA0dJJ8qF-AJlRIGAg
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Solution Guard, LLC</title>
</head>
<body style="background: #F4F4F4;">
<div style="max-width:600px; margin: 0 auto; padding-top:20px;">
<a href="http://t.andrewcollege.edu/track/click/30210239/solutionguard.com?p=eyJzIjoiQjgxaUxaYXZvekdyYTVDTmZXdXd2MHNDMk1vIiwidiI6MSwicCI6IntcInVcIjozMDIxMDIzOSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvc29sdXRpb25ndWFyZC5jb21cIixcImlkXCI6XCI3NWM2Y2RjNjg4NDA0OTllYTQ0MTU3YTIzMDBhOThhYlwiLFwidXJsX2lkc1wiOltcIjU3ODA4MzJlMzEwZWIxNmJhYzNiMjNhYzZjNGZlODYwZDU0NmY2MWNcIl19In0" target="_blank"><img src="https://www.andrewcollege.edu/sites/default/files/attachments/aclogo.png" style="padding: 10px 0px; max-width: 50%; height: auto;" alt="Solution Guard"></a>
</div>
<div style="max-width:600px; margin-left: auto; margin-right: auto; background:#ffffff; padding: 10px 10px 10px 10px; border: 1px solid #cfcfcf;">
<span style="text-align:left; font-family:sans-serif; font-size: 16px; line-height: 150%;"></span>
</div>
<p style="text-align:center; font-family: sans-serif; font-size:13px; line-height:150%">© <a href="http://t.andrewcollege.edu/track/click/30210239/andrewcollege.edu?p=eyJzIjoiZlg1N0IzS1kyQVJqTF9KLWhZSWJyMXNSZXYwIiwidiI6MSwicCI6IntcInVcIjozMDIxMDIzOSxcInZcIjoxLFwidXJsXCI6XCJodHRwczpcXFwvXFxcL2FuZHJld2NvbGxlZ2UuZWR1XCIsXCJpZFwiOlwiNzVjNmNkYzY4ODQwNDk5ZWE0NDE1N2EyMzAwYTk4YWJcIixcInVybF9pZHNcIjpbXCI0NzNkOWZiMWQ3ODUxOGZhMmFjMjE3YzU1N2ZmYjlhYmU0MDgyZjdiXCJdfSJ9" target="_blank">Andrew College</a>
</p>
<img src="http://t.andrewcollege.edu/track/open.php?u=30210239&id=75c6cdc68840499ea44157a2300a98ab" height="1" width="1"></body>
</html>
--_av-zlN5SA0dJJ8qF-AJlRIGAg--
有没有办法将纯文本部分插入 HTML模板?我感谢所有的帮助。
答案 0 :(得分:0)
您将无法同时使用规则,因为使用规则应用的模板只会将当前可用的HTML内容放入模板块(在您的情况下为“main”)。
在应用规则之后会发生将纯文本转换为HTML的过程,因为如果在规则处理期间模板或HTML发生更改,则自动生成的HTML将不再与生成的HTML匹配,必须再次运行。因此,在将消息中继到Mandrill之前,您需要处理转换为HTML。