mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: don't try to send a rejection message when the sender was not detected
This commit is contained in:
@ -35,8 +35,8 @@ module Email
|
||||
|
||||
def handle_failure(mail_string, e)
|
||||
message_template = case e
|
||||
when Email::Receiver::NoSenderDetectedError then return nil
|
||||
when Email::Receiver::EmptyEmailError then :email_reject_empty
|
||||
when Email::Receiver::NoSenderDetectedError then :email_reject_empty
|
||||
when Email::Receiver::NoBodyDetectedError then :email_reject_empty
|
||||
when Email::Receiver::UserNotFoundError then :email_reject_user_not_found
|
||||
when Email::Receiver::ScreenedEmailError then :email_reject_screened_email
|
||||
|
@ -9,6 +9,9 @@ module Email
|
||||
class Receiver
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
# If you add a new error, you need to
|
||||
# * add it to Email::Processor#handle_failure()
|
||||
# * add text to server.en.yml (parent key: "emails.incoming.errors")
|
||||
class ProcessingError < StandardError; end
|
||||
class EmptyEmailError < ProcessingError; end
|
||||
class ScreenedEmailError < ProcessingError; end
|
||||
@ -266,6 +269,13 @@ module Email
|
||||
def parse_from_field(mail)
|
||||
return unless mail[:from]
|
||||
|
||||
if mail.subject == "Test"
|
||||
foo = []
|
||||
if foo[/<[^>]+>/]
|
||||
bar = 2
|
||||
end
|
||||
end
|
||||
|
||||
if mail[:from].errors.blank?
|
||||
mail[:from].address_list.addresses.each do |address_field|
|
||||
address_field.decoded
|
||||
|
Reference in New Issue
Block a user