如何格式化电子邮件的Gmail? [英] How to format email for gmail?

查看:149
本文介绍了如何格式化电子邮件的Gmail?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将电子邮件的正文封装在< html>< body>< pre> 中。 显示原始在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 

我使用 pony 从ruby发送电子邮件。

I send the email from ruby using pony.

任何建议如何根据需要获取gmail中的格式?

Any suggestions how to get the formatting inside gmail as desired?

推荐答案

<这是我发送HTML邮件到Gmail。我猜我缺少的是:html_body =>

This the was I send html email to gmail. I guess what I was missing was :html_body => body, part of pony's settings.

def email_it(body, subject,to,from)
  $smtp = 'mail.com.au'
  $smtp_port = 25
     Pony.mail(
        :to => to, 
        :from => from,
        :subject => subject, 
        :body => Nokogiri::HTML(body).text, 
                    :html_body =>  body,
        :via => :smtp, 
        :via_options => {
                :address     => $smtp,
                :port     => $smtp_port,
                :enable_starttls_auto => false
        }
    )
end

这篇关于如何格式化电子邮件的Gmail?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆