Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Commit

Permalink
adding sendgrid support
Browse files Browse the repository at this point in the history
  • Loading branch information
mockdeep committed Sep 23, 2012
1 parent d7eb83b commit f887a28
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Expand Up @@ -8,6 +8,7 @@ def new
def create
@user = User.new(params[:user])
if @user.save
Notifier.signup_email(@user).deliver
self.current_user = @user
redirect_to root_path, :notice => "Signed up!"
else
Expand Down
10 changes: 10 additions & 0 deletions app/mailers/notifier.rb
@@ -0,0 +1,10 @@
class Notifier < ActionMailer::Base
default :from => "yay@tithe.boon.gl"

# send a signup email to the user, pass in the user object that contains the user's email address
def signup_email(user)
mail( :to => user.email,
:subject => "Thanks for signing up" )
end
end

10 changes: 10 additions & 0 deletions config/environment.rb
Expand Up @@ -3,3 +3,13 @@

# Initialize the rails application
Tithe::Application.initialize!

ActionMailer::Base.smtp_settings = {
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => "tithe.boon.gl",
:address => "smtp.sendgrid.net",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}

0 comments on commit f887a28

Please sign in to comment.