1 class UserNotify < ActionMailer::Base
2 def signup(user, password, url=nil)
6 @subject += "Welcome to #{LoginEngine.config(:app_name)}!"
8 # Email body substitutions
9 @body["name"] = "#{user.firstname} #{user.lastname}"
10 @body["login"] = user.login
11 @body["password"] = password
12 @body["url"] = url || LoginEngine.config(:app_url).to_s
13 @body["app_name"] = LoginEngine.config(:app_name).to_s
16 def forgot_password(user, url=nil)
20 @subject += "Forgotten password notification"
22 # Email body substitutions
23 @body["name"] = "#{user.firstname} #{user.lastname}"
24 @body["login"] = user.login
25 @body["url"] = url || LoginEngine.config(:app_url).to_s
26 @body["app_name"] = LoginEngine.config(:app_name).to_s
29 def change_password(user, password, url=nil)
33 @subject += "Changed password notification"
35 # Email body substitutions
36 @body["name"] = "#{user.firstname} #{user.lastname}"
37 @body["login"] = user.login
38 @body["password"] = password
39 @body["url"] = url || LoginEngine.config(:app_url).to_s
40 @body["app_name"] = LoginEngine.config(:app_name).to_s
43 def pending_delete(user, url=nil)
47 @subject += "Delete user notification"
49 # Email body substitutions
50 @body["name"] = "#{user.firstname} #{user.lastname}"
51 @body["url"] = url || LoginEngine.config(:app_url).to_s
52 @body["app_name"] = LoginEngine.config(:app_name).to_s
53 @body["days"] = LoginEngine.config(:delayed_delete_days).to_s
56 def delete(user, url=nil)
60 @subject += "Delete user notification"
62 # Email body substitutions
63 @body["name"] = "#{user.firstname} #{user.lastname}"
64 @body["url"] = url || LoginEngine.config(:app_url).to_s
65 @body["app_name"] = LoginEngine.config(:app_name).to_s
69 @recipients = "#{user.email}"
70 @from = LoginEngine.config(:email_from).to_s
71 @subject = "[#{LoginEngine.config(:app_name)}] "
73 @headers['Content-Type'] = "text/plain; charset=#{LoginEngine.config(:mail_charset)}; format=flowed"