如何将电子邮件格式化为 Gmail?
我将电子邮件的正文封装在
中。 gmail 中的显示原始内容实际上为我提供了我想要的电子邮件格式:
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Ant run name : Basics of Edumate
Overall result : pass
Ant run took: 4 minutes 15 seconds
--------------------------
Details for all test suits
--------------------------
login : Pass
AddCycleTemplate: Pass
AddCycleTemplate: Pass
AddAcademicYear : Pass
AddAcademicYear : Pass
但实际的电子邮件显示为一行。请注意,我用于对齐 :
的空格以及新行以某种方式被省略。
Ant run name : Basics of Edumate Overall result : pass Ant run took: 4 minutes 15 seconds -------------------------- Details for all test suits -------------------------- login : Pass AddCycleTemplate: Pass AddCycleTemplate: Pass AddAcademicYear : Pass AddAcademicYear : Pass
我使用 pony 从 ruby 发送电子邮件。
有什么建议如何根据需要在 gmail 中设置格式吗?
I wrapped the email's body in <html><body><pre>
. Show original in gmail gives me actually how I want the email to be formatted:
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Ant run name : Basics of Edumate
Overall result : pass
Ant run took: 4 minutes 15 seconds
--------------------------
Details for all test suits
--------------------------
login : Pass
AddCycleTemplate: Pass
AddCycleTemplate: Pass
AddAcademicYear : Pass
AddAcademicYear : Pass
But the actual email is displayed as one line. Note that space that I use to align :
is somehow omitted as well as new lines.
Ant run name : Basics of Edumate Overall result : pass Ant run took: 4 minutes 15 seconds -------------------------- Details for all test suits -------------------------- login : Pass AddCycleTemplate: Pass AddCycleTemplate: Pass AddAcademicYear : Pass AddAcademicYear : Pass
I send the email from ruby using pony.
Any suggestions how to get the formatting inside gmail as desired?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议简单地使用 HTML 表格来做到这一点。
只是为了彻底回答,代码将类似于:
等等。
I would recommend to simply use an HTML table to do that.
Just for the sake of answering thoroughly, the code would be something like:
etc..
我认为使用
进行换行可以,但可能有更好的解决方案......I think using
<br/>
for line breaks would work, but there's probably a better solution...这是我将 html 电子邮件发送到 gmail。我想我缺少的是
:html_body => body,
pony 设置的一部分。This the was I send html email to gmail. I guess what I was missing was
:html_body => body,
part of pony's settings.