0

I've created a sieve script that filters for particular words in Subject, drops the body and sends notification to the recipient and sender.

Everything works well but the only thing I can't figure out is how to change response email not to be from POSTMASTER.

I've changed 15-lda.conf in /etc/dovecot/conf.d

#Address to use when sending rejection mails.
#Default is no-reply@%d. %d expands to recipient domain.
postmaster_address = no-reply@my-domain.com. 

but still getting From: Postmaster Just heads up: dovecot, postfix restarted.

Would you be able to point me what I need to do to change it to something else or get rid of it at all?

This is my script

require ["enotify", "mailbox", "reject", "variables"];

if header :matches "to" ["*", "*", "*"] {
set "r1" "${1}";
set "r2" "${2}";
set "r3" "${3}";
}

if header :matches "from" "*" {
set "sender" "${1}";
}

#sets variables for position in the address and it works for CC and BC aswell.
#This is the way sieve works by setting position in the line for TO or FROM.


if header :matches "Subject" "SEC=SECRET" {
notify :importance "1"
            :message "SEC=SECRET Email Received"
                        "mailto:${r1}${r2}${r3}";
}

if header :matches "Subject" "SEC=TOP SECRET" {
notify :importance "1"
            :message "You have received an email with a SECRET or TOP SECRET classification from ${sender}. The message exceeds the classification of company's email system and has been discarded. The sender of the message has also been informed"
                        "mailto:${r1}${r2}${r3}";
}

if header :matches "Subject" "SEC=TOP-SECRET" {
notify :importance "1"
            :message "You have received an email with a SECRET or TOP SECRET classification from ${sender}. The message exceeds the classification of company's email system and has been discarded. The sender of the message has also been informed"
                        "mailto:${r1}${r2}${r3}";
}
#matches the Subject and if it containes SECRET or TOP SECRET
#sends notification to receivers specified in mailto:
#doesn't include the body of email

if anyof (header :contains "Subject" "SEC=SECRET",
       header :contains "Subject" "SEC=TOP SECRET",
       header :contains "Subject" "SEC=TOP-SECRET")
{

reject "Our systems have not been certified to accept emails classified as SECRET or TOP-SECRET. Your message has been deleted and the recipients have been informed.";

}

#matches the Subject, drops the body and sends notification to the sender with the message specified.
Dave M
  • 4,514
  • 22
  • 31
  • 30
sat
  • 1
  • 1
  • might be useful to attach the relevant part of your script to your question, given there are multiple ways to trigger a message from sieve. – anx Apr 15 '21 at 13:08
  • Hi @anx I've added my script above. Hope that helps to get an idea. – sat Apr 16 '21 at 00:32

1 Answers1

0

Thanks for your reply.

I am not sure if you got the idea of what I am trying to do here.

This is the actual task: "Email servers are configured to block, log and report emails with inappropriate protective markings." "The intended recipients of any blocked inbound emails, and the sender of any blocked outbound emails, are notified." Build a test mailserver using docker-mailserver container, and develop a content filter plugin that blocks, logs and reports messages with SEC=SECRET or SEC=TOP SECRET in the subject line. Notify both sender and recipient without disclosing the content of the message.

Please correct me if I am wrong. In your comment you are talking about 'enotify' action but it has nothing to do with my issue because I use it to send notification email to original recipient. In order to notify original sender I use 'reject' action. Means when incoming email dropped and respond sent back, the original sender gets email from Postmaster. So the question is how to get rid of it?

Thanks

sat
  • 1
  • 1
  • I think I did indeed misread your question. (please put clarifications in an edit of your question, answers are only for, well, answers) – anx Apr 17 '21 at 05:26