View Single Post
Old 22 Jan 2023, 02:16 AM   #1
qwertz123456
Essential Contributor
 
Join Date: Jan 2008
Posts: 378
[Help needed] A few sieve scripts for review

Hey guys,

I need some help with a couple of sieve scripts I'm trying to create.

I'm not a coder so it's a bit more difficult for me to figure out how the syntax works. I tried finding some of the code on the interwebs and here in the forum.

Basically, I want to create the following rules/sieve scripts.

1. Discard messages from specific addresses / exact match

Code:
if address :is ["X-Mail-from"] ["email1@domain.com","email2@domain.com"]
{
  discard;
  stop;
}

2. Discard messages from specific domains / exact match

Code:
if address :domain :is ["X-Mail-from"] ["domain1.com","domain2.com"]
{
  discard;
  stop;
}
Can I combine these two scripts (1 & 2) and what would that look like? Is there any parameter I need to add to combine these into one sieve script?

3. Rejects specific addresses with a message

I do NOT intend to use this for spammers, but for very specific people that I want to know that this address does not exist. I will add further addresses if need be.

Code:
if address :is ["X-Mail-from"]["email1@domain.com","email2@domain.com"]
{
  reject "Mailbox does not exist";
  stop;
}
Is there a way to remove the automatically added "Your message was automatically rejected by Sieve, a mail filtering language." and have the rejected message just say "Mailbox does not exist"?


4. Finding duplicate messages and moving to folder

Code:
require ["duplicate", "variables"];
if header :matches "message-id" "*" {
  if duplicate :uniqueid "${0}" {
    fileinto “Duplicates”;
  }
}
The duplicate folder will be in the root folder of my account. And I assume if I used the message-id that that would be the most strict or exact form of duplicate identification and not have any similar email be moved here. Or is my understanding wrong?

Anyway to have this also search my complete mailbox (all existing folders)? Probably not, right?

Once these sieve scripts are working is there a requirement to drag these rules to the top of the button of my other normal FM rules?

Last edited by qwertz123456 : 22 Jan 2023 at 02:51 AM.
qwertz123456 is offline   Reply With Quote