Make Email::Receiver.check_address() into a class method.

This commit is contained in:
Ryan C. Gordon
2017-04-05 12:45:58 -04:00
parent e15d11df18
commit a51c191a66
2 changed files with 6 additions and 6 deletions

View File

@ -75,7 +75,7 @@ class Admin::EmailController < Admin::AdminController
# These strings aren't localized; they are sent to an anonymous SMTP user.
if User.find_by_email(params[:from]).nil? && !SiteSetting.enable_staged_users
render json: { reject: true, reason: "Mail from your address is not accepted. Do you have an account here?" }
elsif Email::Receiver.new(params[:from]).check_address(params[:to]).nil?
elsif Email::Receiver.check_address(Email.downcase(params[:to])).nil?
render json: { reject: true, reason: "Mail to this address is not accepted. Check the address and try to send again?" }
else
render json: { reject: false }