When having E-Mail addresses that are setup only as forwarding (with SRS) to an external E-Mail address it could happen that the spam filter (rspamd) of my mail server does not classify the incoming E-Mail as Spam and does a forwarding to the external mail server, but that external mail server classifies it as Spam and rejected it due to that.
Now I want to react to that rejection by learning this forwarded E-Mail as Spam too, but I have no clue how I could target that problem.
Ideally, I would quarantine those E-Mails into a dedicated Mailbox where it is initially moved into the Spam folder, this Spam folder could be supervised and Mails that should not be considered as Spam could be moved out of that folder to be learned as Ham again.
While that part of learning is clear and already setup, the problem I currently have is, how could I achieve that a copy of the forwarded mail is moved to that dedicated Mailbox only if the external server responds with a rejection Message (ideally checking what rejection message it was - e.g. ignoring quota errors).
I guess checking what rejection message it was won't be a problem when I know where to do that copying part.
For now, I create a copy of the incoming mails that are forwarded into a dedicated mailbox
spam-learning@
.I did that in the
alias_map
part and updated my query so that all queries that result in a forward all create an alias tospam-learning@
usingUNION
Alternatively, there is
always_bcc
but that's not optimal.A separate process is parsing the mail logs and checks if the
Message-Id
that are stored in that mailbox is rejected or not, and based on that information I learn whether it is spam or not. That is not optimal but works.