2016-07-21 19:11:15 +08:00
|
|
|
class AppMailer < Devise::Mailer
|
2017-04-07 21:01:26 +08:00
|
|
|
helper :application, :mailer, :input_sanitize
|
2016-07-21 19:11:15 +08:00
|
|
|
include Devise::Controllers::UrlHelpers
|
|
|
|
default template_path: 'users/mailer'
|
2017-04-07 21:01:26 +08:00
|
|
|
default from: ENV['MAIL_FROM']
|
|
|
|
default reply: ENV['MAIL_REPLYTO']
|
2016-07-21 19:11:15 +08:00
|
|
|
|
2016-10-13 14:54:29 +08:00
|
|
|
def notification(user, notification, opts = {})
|
2016-10-05 16:52:27 +08:00
|
|
|
@user = user
|
|
|
|
@notification = notification
|
2016-10-07 15:45:30 +08:00
|
|
|
headers = {
|
|
|
|
to: @user.email,
|
|
|
|
subject: I18n.t('notifications.email_title')
|
2016-10-13 14:54:29 +08:00
|
|
|
}.merge(opts)
|
2016-10-05 16:52:27 +08:00
|
|
|
mail(headers)
|
|
|
|
end
|
|
|
|
end
|