Created
October 23, 2012 10:03
-
-
Save cnosuke/3937996 to your computer and use it in GitHub Desktop.
action_mailerでメールを送るあれ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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