Skip to content

Conversation

@DerDreschner
Copy link
Contributor

@DerDreschner DerDreschner commented Jan 8, 2026

The sieve script used by the autoresponder didn't exclude mailing lists and newsletters. This is a problem for multiple reasons:

  • Privacy: You don't want to inform anyone you subscribed a newsletter from to know that you're out-of-office. Additionally, you don't want your out-of-office message being archived in a potentially public mailing list.
  • Spam on mailing lists: You don't want your out-of-office message as reply to any mailing list message as that will be considered spam by the users and administrators
  • Spam through return mails: When replying to newsletters, you could send them to an address that's not configured for receiving mails. This could mean that you're receiving multiple messages from the mailer daemon that can be very confusing for regular users.

To achive that, I use the List-Id header field (like being described in #11660). But when looking for potential test mails, I've realized that I wouldn't cover newsletters when checking only for that field. That's why I choose List-Unsubscribe additionally, as that header is present in messages from most regular newsletters (as that is being enforced by more and more providers for large mail volumes).

I've tested my changes with three mails, one containing only a List-Unsubscribe header field (mail.txt), one that doesn't have any List-* headers (mail2.txt) and one that only has a List-Id header (mail3.txt). As rule, I used the one from the tests/data/mail-filter/service1_new.sieve file.

This is the output from `sieve-test`
 ~ ▓▒░ sieve-test -t - -Tlevel=matching rule.txt mail.txt                                                                                                 ░▒▓ ✔ │ 55s │ 19:06:46 

      ## Started executing script 'rule.txt'
  12: address test
  12:   starting `:is' match with `i;ascii-casemap' comparator:
  12:   extracting `From' headers from message
  12:   parsing address header value `"kununu Jobupdates" <[email protected]>'
  12:   address value `[email protected]'
  12:   extracting `all' part from address <[email protected]>
  12:   matching value `[email protected]'
  12:     with key `[email protected]' => 0
  12:   finishing match with result: not matched
  13: jump if result is false
  13:   jumping to line 22
  22: address test
  22:   starting `:is' match with `i;ascii-casemap' comparator:
  22:   extracting `From' headers from message
  22:   parsing address header value `"kununu Jobupdates" <[email protected]>'
  22:   address value `[email protected]'
  22:   extracting `all' part from address <[email protected]>
  22:   matching value `[email protected]'
  22:     with key `[email protected]' => 0
  22:   finishing match with result: not matched
  22: jump if result is false
  22:   jumping to line 28
  28: currentdatedate test
  28:   starting `:value-ge' match with `i;ascii-casemap' comparator:
  28:   matching value `2026-01-08T19:06:51+01:00'
  28:     with key `2024-10-08T22:00:00Z' => 1
  28:   finishing match with result: matched
  28: jump if result is false
  28:   not jumping
  29: exists test
  29:   header `List-Id' is missing
  29:   headers are missing
  29: jump if result is true
  29:   not jumping
  29: exists test
  29:   header `List-Unsubscribe' exists
  29:   all headers exist
  29: jump if result is true
  29:   jumping to line 30
      ## Finished executing script 'rule.txt'


Performed actions:

  (none)

Implicit keep:

 * store message in folder: INBOX

sieve-test(ddreschner): Info: final result: success

 ~ ▓▒░ sieve-test -t - -Tlevel=matching rule.txt mail2.txt                                                                                                      ░▒▓ ✔ │ 19:06:51 

      ## Started executing script 'rule.txt'
  12: address test
  12:   starting `:is' match with `i;ascii-casemap' comparator:
  12:   extracting `From' headers from message
  12:   parsing address header value `PayPal <[email protected]>'
  12:   address value `[email protected]'
  12:   extracting `all' part from address <[email protected]>
  12:   matching value `[email protected]'
  12:     with key `[email protected]' => 0
  12:   finishing match with result: not matched
  13: jump if result is false
  13:   jumping to line 22
  22: address test
  22:   starting `:is' match with `i;ascii-casemap' comparator:
  22:   extracting `From' headers from message
  22:   parsing address header value `PayPal <[email protected]>'
  22:   address value `[email protected]'
  22:   extracting `all' part from address <[email protected]>
  22:   matching value `[email protected]'
  22:     with key `[email protected]' => 0
  22:   finishing match with result: not matched
  22: jump if result is false
  22:   jumping to line 28
  28: currentdatedate test
  28:   starting `:value-ge' match with `i;ascii-casemap' comparator:
  28:   matching value `2026-01-08T19:06:55+01:00'
  28:     with key `2024-10-08T22:00:00Z' => 1
  28:   finishing match with result: matched
  28: jump if result is false
  28:   not jumping
  29: exists test
  29:   header `List-Id' is missing
  29:   headers are missing
  29: jump if result is true
  29:   not jumping
  29: exists test
  29:   header `List-Unsubscribe' is missing
  29:   headers are missing
  29: jump if result is true
  29:   not jumping
  30: vacation action
  30:   auto-reply with message `I'm not here, please try again later. '
      ## Finished executing script 'rule.txt'


Performed actions:

 * send vacation message:
    => seconds : 345600
    => subject : Thanks for your message!
    => handle  : I'm not here, please try again later. Thanks for your message!<default-from><NO-MIME>

START MESSAGE
I'm not here, please try again later. 
END MESSAGE

Implicit keep:

 * store message in folder: INBOX

sieve-test(ddreschner): Info: final result: success

 ~ ▓▒░ sieve-test -t - -Tlevel=matching rule.txt mail3.txt                                                                                                      ░▒▓ ✔ │ 19:06:55 

      ## Started executing script 'rule.txt'
  12: address test
  12:   starting `:is' match with `i;ascii-casemap' comparator:
  12:   extracting `From' headers from message
  12:   parsing address header value `DHL Paket <[email protected]>'
  12:   address value `[email protected]'
  12:   extracting `all' part from address <[email protected]>
  12:   matching value `[email protected]'
  12:     with key `[email protected]' => 0
  12:   finishing match with result: not matched
  13: jump if result is false
  13:   jumping to line 22
  22: address test
  22:   starting `:is' match with `i;ascii-casemap' comparator:
  22:   extracting `From' headers from message
  22:   parsing address header value `DHL Paket <[email protected]>'
  22:   address value `[email protected]'
  22:   extracting `all' part from address <[email protected]>
  22:   matching value `[email protected]'
  22:     with key `[email protected]' => 0
  22:   finishing match with result: not matched
  22: jump if result is false
  22:   jumping to line 28
  28: currentdatedate test
  28:   starting `:value-ge' match with `i;ascii-casemap' comparator:
  28:   matching value `2026-01-08T19:06:58+01:00'
  28:     with key `2024-10-08T22:00:00Z' => 1
  28:   finishing match with result: matched
  28: jump if result is false
  28:   not jumping
  29: exists test
  29:   header `List-Id' exists
  29:   all headers exist
  29: jump if result is true
  29:   jumping to line 30
      ## Finished executing script 'rule.txt'


Performed actions:

  (none)

Implicit keep:

 * store message in folder: INBOX

sieve-test(ddreschner): Info: final result: success

 ~ ▓▒░  

This fixes #11660.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👏

@ChristophWurst
Copy link
Member

Error: lib/Service/Attachment/AttachmentService.php:86:34: PossiblyInvalidArgument: Argument 2 of OCA\Mail\Service\Attachment\AttachmentStorage::save expects int, but possibly different type int|null|string provided (see https://psalm.dev/092)
Error: lib/Service/Attachment/AttachmentService.php:104:41: PossiblyInvalidArgument: Argument 2 of OCA\Mail\Service\Attachment\AttachmentStorage::saveContent expects int, but possibly different type int|null|string provided (see https://psalm.dev/092)

This is unrelated to your changes and one of the adjustments we have to make for snowflake ids. Could you take care of that in a separate PR please?

@DerDreschner
Copy link
Contributor Author

Yeah, sure! I'll look into it right now.

@DerDreschner DerDreschner force-pushed the fix/disable-autoresponder-on-automatic-mail branch from a000ef2 to 4dd3824 Compare January 8, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autoresponder responds to mailng lists

2 participants