Skip to content

Instantly share code, notes, and snippets.

@kosaki
Created March 29, 2014 23:48
Show Gist options
  • Save kosaki/9864928 to your computer and use it in GitHub Desktop.
Save kosaki/9864928 to your computer and use it in GitHub Desktop.
require 'mail'
Mail.defaults do
options = { :address => "smtp.gmail.com",
:port => 587,
:user_name => 'kosaki.motohiro',
:password => 'パスワード',
:authentication => 'plain',
:enable_starttls_auto => true }
delivery_method :smtp, options
end
mail = Mail.new do
from '[email protected]'
to '[email protected]'
subject 'ruby mail test'
body 'body'
end
#puts mail.to_s #=> "From: [email protected]\r\nTo: you@...
mail.deliver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment