jam-cloud/lib/jam_ruby/app/mailers/user_mailer.rb

71 lines
2.2 KiB
Ruby

module JamRuby
# UserMailer must be configured to work
# Some common configs occur in jam_ruby/init.rb
# Environment specific configs occur in spec_helper.rb in jam-ruby and jam-web (to put it into test mode),
# and in config/initializers/email.rb in rails to configure sendmail account settings
# If UserMailer were to be used in another project, it would need to be configured there, as well.
# Templates for UserMailer can be found in jam_ruby/app/views/jam_ruby/user_mailer
class UserMailer < ActionMailer::Base
include SendGrid
layout "user_mailer"
DEFAULT_SENDER = "support@jamkazam.com"
default :from => DEFAULT_SENDER
sendgrid_category :use_subject_lines
#sendgrid_enable :opentrack, :clicktrack # this makes our emails creepy, imo (seth)
sendgrid_unique_args :env => Environment.mode
def welcome_message(user, signup_confirm_url)
@user = user
@signup_confirm_url = signup_confirm_url
sendgrid_category "Welcome"
sendgrid_unique_args :type => "welcome_message"
mail(:to => user.email, :subject => "Welcome #{user.first_name} to Jamkazam") do |format|
format.text
format.html
end
end
def password_changed(user)
@user = user
sendgrid_unique_args :type => "password_changed"
mail(:to => user.email, :subject => "Jamkazam Password Changed") do |format|
format.text
format.html
end
end
def password_reset(user)
@user = user
sendgrid_unique_args :type => "password_reset"
mail(:to => user.email, :subject => "Jamkazam Password Reset") do |format|
format.text
format.html
end
end
def updating_email(user)
@user = user
sendgrid_unique_args :type => "updating_email"
mail(:to => user.update_email, :subject => "Jamkazam Email Change Confirmation") do |format|
format.text
format.html
end
end
def updated_email(user)
@user = user
sendgrid_unique_args :type => "updated_email"
mail(:to => user.email, :subject => "Jamkazam Email Changed") do |format|
format.text
format.html
end
end
end
end