Gmailer

How can i send HTML emails using the ruby gmailer module?

There are a few aspects to it:

This is were the question belongs:
http://rubyforge.org/forum/forum.php?forum_id=3738

This is about the pitfalls of how popular email clients read HTML and
therefore how you should write HTML that would display correctly.

http://www.pageresource.com/html/html_email.htm

Markaby is a great way to generate HTML, although you might want to
try what Ara announced yesterday (xx I think) which is claimed to be
more powerful.

This is an example of how to send email with Gmailer:
GMailer.connect(name, pwd) do |g|
# ‘From’ default gmail.com account
g.send(
:to => “[email protected], [email protected]_company.com,
[email protected]”,
:cc => “[email protected]”,
:subject => “Hello There!”,
:body => “Hi…\n\nBlah blah blah~…”,
:files => ["./my_pic.jpg", “./my_cv.txt”])

  # multiple verified email addresses and choose one 'From:' email 

address
g.send(
:from => “[email protected]”,
:to => “[email protected], [email protected]_company.com,
[email protected]domain.invalid”,
:cc => “[email protected]”,
:subject => “Hello There!”,
:body => “Hi…\n\nBlah blah blah~…”,
:files => ["./my_pic.jpg", “./my_cv.txt”])
end

(taken form gmailer readme).

This helps you with MIME handling so you can compose a MIME message
easily:
http://rubyforge.org/projects/rubymail/

I think you can just stick the MIME message’s .to_s as :body for
Gmailer#send. Experiment with it.

In case you don’t know about MIME and HTML email, well… All you need
to do is have a content-type of text/html for the message body.

Google further.

I also advise you to have a look at the adopt-a-newbie project here at
the ML.

Aur S.

Might want to give mailfactory a try
http://www.grayskies.net/mailfactory

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs