internetee-registry/app/mailers/application_mailer.rb
Artur Beljajev a113d75ec5 Remove hardcoded default email sender
And make it configurable via `action_mailer_default_from` config.

Closes #243
2019-04-18 19:01:59 +03:00

18 lines
585 B
Ruby

class ApplicationMailer < ActionMailer::Base
append_view_path Rails.root.join('app', 'views', 'mailers')
layout 'mailer'
# turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything
def delivery_off?(model, deliver_emails = false)
return false if deliver_emails == true
logger.info "EMAIL SENDING WAS NOT ACTIVATED " \
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
true
end
def format(email)
local, host = email.split('@')
host = SimpleIDN.to_ascii(host)
"#{local}@#{host}"
end
end