I am trying to achieve sending a multipart newsletter so that people
with html mail capabilities will see a glorified version of the email,
and people like me who use pine will see plaintext.
As of right now, I have:
part “text/plain” do |p|
if newsletter.newsletter.length == 0
p.body = “”
else
greeting = contact.first_name || ‘Hello’
p.body = “#{greeting},\n\n” + newsletter.newsletter
end
end
part "text/html" do |p|
if newsletter.newsletter.length == 0
p.body = ""
else
greeting = contact.first_name || 'Hello'
p.body = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01
Transitional//EN’>
#{greeting},
" + newsletter.newsletter +
“
end
end
newsletter.attachments.each do |attachment|
part attachment.content_type do |p|
p.body = attachment.contents
p.filename = attachment.filename
p.transfer_encoding = 'base64'
end
end
rescue
return false
end
return true
end
end
however this is rendering HTML as an “attachment”… I am very unclear
about how this is supposed to work, but I just know if I look at an
email sent by Yahoo for example, their html mail shows up as plaintext,
and I see a separate index that I can select in pine which will then
attempt to launch a browser to view it… And if I look at this same
email in a browser, it appears as a nice clean html version. However
when looking at my own email in pine, it displays both side by side as
PART1: plaintext and PART2: HTML…
This is the same behavior when viewing in a browser as you can see here:
http://www.collinatorstudios.com/www/budokonmail2.png
I tried changing this to have:
part :content_type => “text/html”,
:body => render_message(“signup-as-html”, :account => recipient)
as I saw on several websites that were giving tutorial discussions on
html email within ruby on rails, bowever this did not work…