jam-cloud/ruby/lib/jam_ruby/app/mailers/invited_user_mailer.rb

56 lines
2.1 KiB
Ruby

module JamRuby
# InvitedUserMailer 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 InvitedUserMailer were to be used in another project, it would need to be configured there, as well.
# Templates for InvitedUserMailer can be found in jam_ruby/app/views/jam_ruby/user_mailer
class InvitedUserMailer < ActionMailer::Base
include SendGrid
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
# sent in the case of a general 'service invitation', from no one person in particular
def welcome_betauser(invited_user)
@signup_url = generate_signup_url(invited_user)
@suppress_user_has_account_footer = true
sendgrid_category "Welcome"
sendgrid_unique_args :type => "welcome_betauser"
mail(:to => invited_user.email, :subject => "Welcome to the JamKazam Beta release") do |format|
format.text
format.html { render :layout => "user_mailer" }
end
end
# used when sending an invitation from one user to another
def friend_invitation(invited_user)
@signup_url = generate_signup_url(invited_user)
@sender = invited_user.sender
@note = invited_user.note
@suppress_user_has_account_footer = true
sendgrid_category "Invitation"
sendgrid_unique_args :type => "friend_invitation"
mail(:to => invited_user.email, :subject => "You've been invited to JamKazam by #{invited_user.sender.name}") do |format|
format.text
format.html { render :layout => "from_user_mailer" }
end
end
def generate_signup_url(invited_user)
invited_user.generate_signup_url
# "http://www.jamkazam.com/signup?invitation_code=#{invited_user.invitation_code}"
end
end
end