Skip to content

Instantly share code, notes, and snippets.

@cnosuke
Created October 23, 2012 10:03
Show Gist options
  • Save cnosuke/3937996 to your computer and use it in GitHub Desktop.
Save cnosuke/3937996 to your computer and use it in GitHub Desktop.
action_mailerでメールを送るあれ
# coding:utf-8
require 'action_mailer'
class GMails < ActionMailer::Base
default from: "noreply@example.com"
def sendmail
mail(:to => "to@example.com",
:subject => "Welcome test mail",
:body => "hello!" )
end
end
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => :true,
:address => "smtp.gmail.com",
:port => 587,
:authentication => :login,
:user_name => "noreply@example.com",
:password => "passpasss",
:domain => "gmail.com"
}
GMails.sendmail.deliver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment