Guest User

Untitled

a guest
Jun 21st, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.64 KB | None | 0 0
  1.   alternative = Mail.new do
  2.     text_part do
  3.       content_type 'text/plain; charset=UTF-8'
  4.       body 'Plain text content.'
  5.     end
  6.  
  7.     html_part do
  8.       content_type 'text/html; charset=UTF-8'
  9.       body '<html><b>HTML</b> content.</html>'
  10.     end
  11.   end
  12.  
  13.   mixed = Mail.new do
  14.     to 'YOU <you@foo.com>'
  15.     from 'ME <me@foo.com>'
  16.     subject 'Trick into multipart/mixed.'
  17.  
  18.     body_part = Mail::Part.new
  19.     body_part.body = alternative.body.encoded
  20.     body_part.content_type = alternative.content_type
  21.     add_part(body_part)
  22.  
  23.     add_file(:filename => 'file.txt', :content => 'FILE CONTENTS HERE')
  24.   end
  25.  
  26.   mail.deliver
Add Comment
Please, Sign In to add comment