Create a gist now

Instantly share code, notes, and snippets.

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 'kosaki.motohiro@gmail.com'
to 'kosaki.motohiro@gmail.com'
subject 'ruby mail test'
body 'body'
end
#puts mail.to_s #=> "From: mikel@test.lindsaar.net\r\nTo: you@...
mail.deliver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment