FIX: don't try to send a rejection message when the sender was not detected
This commit is contained in:
parent
a2187b0acd
commit
d51eee4dbc
|
@ -68,6 +68,7 @@ en:
|
||||||
no_message_id_error: "Happens when the mail has no 'Message-Id' header."
|
no_message_id_error: "Happens when the mail has no 'Message-Id' header."
|
||||||
auto_generated_email_error: "Happens when the 'precedence' header is set to: list, junk, bulk or auto_reply, or when any other header contains: auto-submitted, auto-replied or auto-generated."
|
auto_generated_email_error: "Happens when the 'precedence' header is set to: list, junk, bulk or auto_reply, or when any other header contains: auto-submitted, auto-replied or auto-generated."
|
||||||
no_body_detected_error: "Happens when we couldn't extract a body and there were no attachments."
|
no_body_detected_error: "Happens when we couldn't extract a body and there were no attachments."
|
||||||
|
no_sender_detected_error: "Happens when we couldn't find a valid email address in the From header."
|
||||||
inactive_user_error: "Happens when the sender is not active."
|
inactive_user_error: "Happens when the sender is not active."
|
||||||
blocked_user_error: "Happens when the sender has been blocked."
|
blocked_user_error: "Happens when the sender has been blocked."
|
||||||
bad_destination_address: "Happens when none of the email addresses in To/Cc/Bcc fields matched a configured incoming email address."
|
bad_destination_address: "Happens when none of the email addresses in To/Cc/Bcc fields matched a configured incoming email address."
|
||||||
|
|
|
@ -35,8 +35,8 @@ module Email
|
||||||
|
|
||||||
def handle_failure(mail_string, e)
|
def handle_failure(mail_string, e)
|
||||||
message_template = case e
|
message_template = case e
|
||||||
|
when Email::Receiver::NoSenderDetectedError then return nil
|
||||||
when Email::Receiver::EmptyEmailError then :email_reject_empty
|
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::NoBodyDetectedError then :email_reject_empty
|
||||||
when Email::Receiver::UserNotFoundError then :email_reject_user_not_found
|
when Email::Receiver::UserNotFoundError then :email_reject_user_not_found
|
||||||
when Email::Receiver::ScreenedEmailError then :email_reject_screened_email
|
when Email::Receiver::ScreenedEmailError then :email_reject_screened_email
|
||||||
|
|
|
@ -9,6 +9,9 @@ module Email
|
||||||
class Receiver
|
class Receiver
|
||||||
include ActionView::Helpers::NumberHelper
|
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 ProcessingError < StandardError; end
|
||||||
class EmptyEmailError < ProcessingError; end
|
class EmptyEmailError < ProcessingError; end
|
||||||
class ScreenedEmailError < ProcessingError; end
|
class ScreenedEmailError < ProcessingError; end
|
||||||
|
@ -266,6 +269,13 @@ module Email
|
||||||
def parse_from_field(mail)
|
def parse_from_field(mail)
|
||||||
return unless mail[:from]
|
return unless mail[:from]
|
||||||
|
|
||||||
|
if mail.subject == "Test"
|
||||||
|
foo = []
|
||||||
|
if foo[/<[^>]+>/]
|
||||||
|
bar = 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if mail[:from].errors.blank?
|
if mail[:from].errors.blank?
|
||||||
mail[:from].address_list.addresses.each do |address_field|
|
mail[:from].address_list.addresses.each do |address_field|
|
||||||
address_field.decoded
|
address_field.decoded
|
||||||
|
|
Loading…
Reference in New Issue