Your question
I run a mail server for a non-profit and I’m trying to replace the convoluted mess of Postfix, Dovecot and Mailman with Stalwart. As a standard mailserver, its working great but I have three requirements that I can’t seem to make work. I have some experience with Sieve from Dovecot and I’ve been using some examples I found here.
For context, I have several mailing lists that behave like aliases so, for example, mail to [email protected] gets forwarded to the current president’s personal email. Anyone should be able to send messages to those lists. But then I have some others that are, basically, outbound. [email protected] is the big one. For this one I want only the current officers or a “real” eaa27.org account to be able to post. I have the officers in a key-value list. The script I’m using is supposed to add a debug header but I don’t see it in any of my test messages. So my feeling is the script isn’t being called. I am using the condition “rcpt == ‘[email protected]’” in the RCPT TO stage.
list_sender_check
# Reject anyone who's not an officer or not sending from eaa27.org
require ["variables", "envelope", "vnd.stalwart.expressions", "reject"];
eval "add_header('X-script-debug-1', envelope.from)";
if anyof (
not envelope :domain "from" "eaa27.org",
not eval "key_exists('officers', to_lowercase(envelope.from))"
) {
reject "550 5.7.1 Sender not authorized by this mail system.";
}
Next, emulating a Mailman feature, I’d like to add ‘[EAA27]’ to the subject line of any message going out. I’m not sure the best place to implement this one. I tried in the DATA stage with a “true” in the condition but, again, it doesn’t seem to be triggered.
require ["variables", "editheader", "envelope"];
if header :matches "Subject" "*" {
set "old_subject" "${1}";
deleteheader "Subject";
addheader "Subject" "[EAA Chapter 27] ${old_subject}";
} else {
addheader "Subject" "[EAA Chapter 27]";
}
The final requirement is to help avoid SPF problems and that is when the President sends a message from his personal email I want the sender to get rewritten as ‘[email protected]’. That’s why I created the key-value list but I’m totally lost as to how to actually implement that.
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on
