Class: UserNotify
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- UserNotify
- Defined in:
- app/models/user_notify.rb
Instance Method Summary collapse
- #change_password(user, password, url = nil) ⇒ Object
- #forgot_password(user, url = nil) ⇒ Object
- #setup_email(user) ⇒ Object
- #signup(user, password, url = nil) ⇒ Object
Instance Method Details
#change_password(user, password, url = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/user_notify.rb', line 29 def change_password(user, password, url=nil) setup_email(user) # Email header info @subject += "Changed password notification" # Email body substitutions @body["name"] = "#{user.first_name} #{user.last_name}" @body["login"] = user.login @body["password"] = password @body["url"] = url || UserSystem::CONFIG[:app_url].to_s @body["app_name"] = UserSystem::CONFIG[:app_name].to_s end |
#forgot_password(user, url = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/user_notify.rb', line 16 def forgot_password(user, url=nil) setup_email(user) # Email header info @subject += "Forgotten password notification" # Email body substitutions @body["name"] = "#{user.first_name} #{user.last_name}" @body["login"] = user.login @body["url"] = url || UserSystem::CONFIG[:app_url].to_s @body["app_name"] = UserSystem::CONFIG[:app_name].to_s end |
#setup_email(user) ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/models/user_notify.rb', line 43 def setup_email(user) @recipients = "#{user.email}" @from = UserSystem::CONFIG[:email_from].to_s @subject = "[#{UserSystem::CONFIG[:app_name]}] " @sent_on = Time.now @headers['Content-Type'] = "text/plain; charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed" end |
#signup(user, password, url = nil) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/user_notify.rb', line 2 def signup(user, password, url=nil) setup_email(user) # Email header info @subject += "Welcome to #{UserSystem::CONFIG[:app_name]}!" # Email body substitutions @body["name"] = "#{user.first_name} #{user.last_name}" @body["login"] = user.login @body["password"] = password @body["url"] = url || UserSystem::CONFIG[:app_url].to_s @body["app_name"] = UserSystem::CONFIG[:app_name].to_s end |