Commit d1dc50bc authored by paz's avatar paz

Improve wording about automated messages.

Not all of those were bounces, the texts were a little misleading.
parent 40ae84a4
...@@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ...@@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Tolerate 0x-prefix on input for fingerprints of subscriptions. * Tolerate 0x-prefix on input for fingerprints of subscriptions.
* Tolerate spaces on input for fingerprints in keywords. * Tolerate spaces on input for fingerprints in keywords.
* `X-GET-KEY` returns keys as attachments now. * `X-GET-KEY` returns keys as attachments now.
* The texts that describe the forwarded automated messages now reflect that not all of those were bounces.
### Fixed ### Fixed
......
module Schleuder module Schleuder
module Filters module Filters
def self.forward_bounce_to_admins(list, mail) def self.forward_bounce_to_admins(list, mail)
if mail.bounce? if mail.automated_message?
list.logger.info "Forwarding bounce to admins" list.logger.info "Forwarding automated message to admins"
list.logger.notify_admin I18n.t(:forward_bounce_to_admins), mail.original_message, I18n.t('bounce') list.logger.notify_admin I18n.t(:forward_automated_message_to_admins), mail.original_message, I18n.t('automated_message_subject')
exit exit
end end
end end
......
...@@ -171,7 +171,7 @@ module Mail ...@@ -171,7 +171,7 @@ module Mail
@recipient.match(/-request@/) @recipient.match(/-request@/)
end end
def bounce? def automated_message?
@recipient.match(/-bounce@/) || @recipient.match(/-bounce@/) ||
# Empty Return-Path # Empty Return-Path
self.return_path.to_s == '<>' || self.return_path.to_s == '<>' ||
......
...@@ -133,8 +133,8 @@ de: ...@@ -133,8 +133,8 @@ de:
notice: Hinweis notice: Hinweis
incoming_message: Eingehende Email incoming_message: Eingehende Email
forward_all_incoming_to_admins: Die angehängte Email ging ein. forward_all_incoming_to_admins: Die angehängte Email ging ein.
forward_bounce_to_admins: Die angehängte Email ging als zurückgewiesen (bounce) ein. forward_automated_message_to_admins: Die angehängte Email wurde vermutlich von einer Maschine und nicht von einem Menschen versendet. Daher ist sie nicht über die Liste verteilt sondern an euch Admins weitergeleitet worden.
bounce: Zurückgewiesene Nachricht automated_message_subject: Automatische Nachricht empfangen
check_keys: Schlüsselprüfung check_keys: Schlüsselprüfung
check_keys_intro: "Bitte kümmere dich um die folgenden Schlüssel für Liste %{email}." check_keys_intro: "Bitte kümmere dich um die folgenden Schlüssel für Liste %{email}."
key_expires: Schlüssel %{fingerprint} %{email} läuft in %{days} Tagen ab. key_expires: Schlüssel %{fingerprint} %{email} läuft in %{days} Tagen ab.
......
...@@ -133,8 +133,8 @@ en: ...@@ -133,8 +133,8 @@ en:
notice: Notice notice: Notice
incoming_message: Incoming message incoming_message: Incoming message
forward_all_incoming_to_admins: The attached message was received. forward_all_incoming_to_admins: The attached message was received.
forward_bounce_to_admins: The attached message was received as bounce. forward_automated_message_to_admins: Attached is a message that probably was sent by a machine, not a human. Therefore it has not been passed on to the list, but only to you, the admins.
bounce: Bounced message automated_message_subject: Automated message received
check_keys: Keys check check_keys: Keys check
check_keys_intro: "Please take care of these keys for list %{email}." check_keys_intro: "Please take care of these keys for list %{email}."
key_expires: Key %{fingerprint} expires in %{days} days. key_expires: Key %{fingerprint} expires in %{days} days.
......
...@@ -85,8 +85,8 @@ describe 'someone sends an email to a listname-dash-address' do ...@@ -85,8 +85,8 @@ describe 'someone sends an email to a listname-dash-address' do
message = raw_msg.setup(list.email, list) message = raw_msg.setup(list.email, list)
expect(message.to).to eql(['admin@example.org']) expect(message.to).to eql(['admin@example.org'])
expect(message.subject).to eql('Bounced message') expect(message.subject).to eql(I18n.t('automated_message_subject'))
expect(message.parts.first.body.to_s).to eql('The attached message was received as bounce.') expect(message.parts.first.body.to_s).to eql(I18n.t('forward_automated_message_to_admins'))
expect(message.parts.last.mime_type).to eql('message/rfc822') expect(message.parts.last.mime_type).to eql('message/rfc822')
expect(message.parts.last.body.to_s).to include('From: mailer-daemon@example.org') expect(message.parts.last.body.to_s).to include('From: mailer-daemon@example.org')
expect(message.parts.last.body.to_s).to include(mail.message_id) expect(message.parts.last.body.to_s).to include(mail.message_id)
......
...@@ -17,5 +17,26 @@ describe Mail::Message do ...@@ -17,5 +17,26 @@ describe Mail::Message do
expect(message.parts.first.mime_type).to eql('image/png') expect(message.parts.first.mime_type).to eql('image/png')
expect(message.parts.last.mime_type).to eql('text/plain') expect(message.parts.last.mime_type).to eql('text/plain')
end end
# TODO: test message with "null" address ("<>") as Return-Path. I couldn't
# bring Mail to generate such a message, yet.
it "recognizes a message sent to listname-bounce@hostname as automated
message" do
list = create(:list)
mail = Mail.new
mail = mail.setup('something-bounce@localhost', list)
expect(mail.automated_message?).to be(true)
end
it "recognizes a message with 'Auto-Submitted'-header as automated message" do
list = create(:list)
mail = Mail.new
mail.header['Auto-Submitted'] = 'yes'
mail = mail.setup('something@localhost', list)
expect(mail.automated_message?).to be(true)
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment