Email block list logging and fix

This commit is contained in:
Priit Tark 2015-07-28 19:58:16 +03:00
parent 0a0543c715
commit 1c7febf47a

View file

@ -8,8 +8,8 @@ class ApplicationMailer < ActionMailer::Base
emails = [emails] unless emails.is_a?(Array)
emails = emails.flatten
emails.each do |email|
next unless TEST_EMAILS.include?(email)
logger.warn "EMAIL SENDING WAS BLOCKED BY WHITELIST: #{email}"
next if TEST_EMAILS.include?(email)
logger.info "EMAIL SENDING WAS BLOCKED BY WHITELIST: #{email}"
return true
end
false
@ -18,7 +18,7 @@ class ApplicationMailer < ActionMailer::Base
# turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything
def delivery_off?(model)
return false if model.deliver_emails == true
logger.warn "EMAIL SENDING WAS NOT ACTIVATED " \
logger.info "EMAIL SENDING WAS NOT ACTIVATED " \
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
true
end