Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement ability to customize sender name in emails.

  • Loading branch information...
commit c3d68cb29ee3c88ffddcb96b6596d76eae5f5ed3 1 parent c0fdb95
@sibprogrammer authored
View
3  .gitignore
@@ -3,7 +3,7 @@ tmp/**/*
tmp/*.txt
db/*.sqlite3
config/database.yml
-.idea
+config/config.yml
utils/watchdog/watchdog.log
utils/watchdog/watchdog.pid
utils/hw-daemon/hw-daemon.log
@@ -12,4 +12,3 @@ utils/hw-daemon/hw-daemon.ini
build/build.log
build/ovz-web-panel-*.tgz
build/ovz-web-panel
-*.sw?
View
14 app/models/user_mailer.rb
@@ -3,21 +3,29 @@
class UserMailer < ActionMailer::Base
def restore_password_email(user, link)
- recipients user.email
+ setup_common_fields(user.email)
subject I18n.t('restore_password.mail.restore_link.subject')
body :link => (link + "?user_id=#{user.id}&hash=" + Digest::SHA1.hexdigest(user.crypted_password + user.login))
end
def request_email(user, request)
- recipients user.email
+ setup_common_fields(user.email)
subject I18n.t('admin.requests.mail.new_request.subject', :id => request.id)
body :request => request
end
def request_comment_email(user, comment)
- recipients user.email
+ setup_common_fields(user.email)
subject I18n.t('admin.requests.mail.new_comment.subject', :request_id => comment.request_id)
body :comment => comment
end
+ private
+
+ def setup_common_fields(email)
+ from_address = AppConfig.email.from
+ from from_address if from_address
+ recipients email
+ end
+
end
View
3  config/initializers/app_config.rb
@@ -54,6 +54,9 @@
'host' => 'example.com',
'login_pattern' => 'uid=<login>,ou=people,dc=example,dc=com',
},
+ 'email' => {
+ 'from' => '',
+ },
}
def hashes2ostruct(object)
Please sign in to comment.
Something went wrong with that request. Please try again.