Skip to content

Instantly share code, notes, and snippets.

@dmitry
Created April 29, 2016 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry/aab8fdca10049d61faad5d0323e969b4 to your computer and use it in GitHub Desktop.
Save dmitry/aab8fdca10049d61faad5d0323e969b4 to your computer and use it in GitHub Desktop.
Use ActionMailer config to send plain through plain Mail
Mail.defaults do
delivery_method ActionMailer::Base.delivery_method, ActionMailer::Base.smtp_settings
end
mail = Mail.deliver do
to 'dmitry.polushkin@gmail.com'
from 'Mikel Lindsaar <test@9flats.com>'
subject 'First multipart email sent with Mail'
text_part do
body 'This is plain text'
end
html_part do
content_type 'text/html; charset=UTF-8'
body '<h1>This is HTML</h1>'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment