I am trying to send email using gem 'mail' with Ruby 1.9.3. It contains the text / html and the text / regular part, which should be embedded as alternative parts, as well as an attachment.
This is my current code:
require 'mail' mail = Mail.new mail.delivery_method :sendmail mail.sender = " me@example.com " mail.to = " someguy@example.com " mail.subject = "Multipart Test" mail.content_type = "multipart/mixed" html_part = Mail::Part.new do content_type 'text/html; charset=UTF-8' body "<h1>HTML</h1>" end text_part = Mail::Part.new do body "TEXT" end mail.part :content_type => "multipart/alternative" do |p| p.html_part = html_part p.text_part = text_part end mail.add_file :filename => "file.txt", :content => "FILE" mail.deliver!
This results in mail with working alternate parts, but without an app. I am using thunderbird 10.0.12 for testing.
I already posted this on github, but unfortunately the posts don't make me smarter. https://github.com/mikel/mail/issues/118#issuecomment-12276876 . Maybe someone can understand the last message a little better than me;)
Can anyone make this example work?
Thanks Krissi
source share