Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alternative = Mail.new do
- text_part do
- content_type 'text/plain; charset=UTF-8'
- body 'Plain text content.'
- end
- html_part do
- content_type 'text/html; charset=UTF-8'
- body '<html><b>HTML</b> content.</html>'
- end
- end
- mixed = Mail.new do
- to 'YOU <you@foo.com>'
- from 'ME <me@foo.com>'
- subject 'Trick into multipart/mixed.'
- body_part = Mail::Part.new
- body_part.body = alternative.body.encoded
- body_part.content_type = alternative.content_type
- add_part(body_part)
- add_file(:filename => 'file.txt', :content => 'FILE CONTENTS HERE')
- end
- mail.deliver
Add Comment
Please, Sign In to add comment