This is not a job for dovecot. You should look into whatever is your MTA (exim, postfix etc) and implement the solution there.
But my initial suggestion is to check SPF and DKIM of the email. Because I know that gmail does terminate spammers quick, but if you don't validate SPF or DKIM, you might be a victim of spoofed Gmail email.
Best regards, Sebastian Nielsen
-----Ursprungligt meddelande----- Från: dovecot-bounces@dovecot.org <dovecot-bounces@dovecot.org> För Marc Roos Skickat: den 11 juni 2020 10:21 Till: dovecot <dovecot@dovecot.org>; users <users@spamassassin.apache.org> Ämne: handling spam from gmail.
I am sick of this gmail spam. Does anyone know a solution where I can do something like this:
received email from adcpni444@gmail.com
system recognizes this email address has been 'whitelisted', continue with 7.
system recognizes as this email never been seen before
auto reply with something like (maybe with a wait time of x hours): Your message did not receive the final recipient. You are sending from a known spam provider network that is why we blocked your message. Please confirm that: the above.
- you are not a spammer and
- you have permission to use the mail adress you send your message to
- you and your provider agree to uphold GDPR legislation
- you and your provider are liable for damages when breaching any of
Click link to confirm and you agree with the above https://www.domainwithoutletsencryptcertificate.com/asdfasdfadsfaf
sender clicks confirm url
email address is added to some white list.
email is delivered to recipient.