Skip to content
Browse files

adding sendgrid support

  • Loading branch information...
1 parent d7eb83b commit f887a28b134991bcca0510bb3d1686deb57437f2 @mockdeep mockdeep committed
Showing with 21 additions and 0 deletions.
  1. +1 −0 app/controllers/users_controller.rb
  2. +10 −0 app/mailers/notifier.rb
  3. +10 −0 config/environment.rb
View
1 app/controllers/users_controller.rb
@@ -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
View
10 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
+
View
10 config/environment.rb
@@ -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.
Something went wrong with that request. Please try again.