EmailDiscussions.com  

Go Back   EmailDiscussions.com > Email Service Provider-specific Forums > FastMail Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Stay in touch wirelessly

FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc.

Reply
 
Thread Tools
Old 14 Dec 2018, 02:42 AM   #1
ferrety
Member
 
Join Date: Mar 2018
Posts: 48
sieve script for blocking mailchimp to specific alias email

How would I write a rule for sieve to stop ALL mail being sent to a specific alias email via mailchimp. Alias email has to be in the semi-public domain so no point changing it but certain organisations are begging me for money via mailchimp. If you need the raw data info let me know which bit. thx
ferrety is offline   Reply With Quote

Old 14 Dec 2018, 05:18 AM   #2
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 2,751
When constructing complex sieve rules, you need to carefully examine the headers of the messages you want to manipulate. Perhaps, you could post the headers of two representative messages,, obscuring personally identifiable information. (I suggest changing the part of an email address that identifies an individual account to something like '<my-account>', '<sender's-account>').
BritTim is offline   Reply With Quote
Old 14 Dec 2018, 11:01 AM   #3
somdcomputerguy
Cornerstone of the Community
 
Join Date: Jun 2004
Location: Rupert, WV
Posts: 584
When a particular email is opened to be read, click on the 'more' dropdown and then the 'Add rule from message' choice. The 'Mailing List ID' spec should already be one of the conditions, then click the 'Add Condition' button and add the specific email address that you want this rule to apply to.

If that doesn't work, you can delete the 'ID' condition, and add one like this:

https://monosnap.com/file/Kag0BI2Cee...jz4Xs37WpHhFKz

This is what I'd do, hopefully it works for you as well.

- Bruce

edit: if it's a legitimate mailing list email, perhaps just unsubscribe from it..
somdcomputerguy is offline   Reply With Quote
Old 15 Dec 2018, 02:18 PM   #4
ferrety
Member
 
Join Date: Mar 2018
Posts: 48
Quote:
Originally Posted by BritTim View Post
When constructing complex sieve rules, you need to carefully examine the headers of the messages you want to manipulate. Perhaps, you could post the headers of two representative messages,, obscuring personally identifiable information. (I suggest changing the part of an email address that identifies an individual account to something like '<my-account>', '<sender's-account>').
I'm not posting the whole thing because I'm scared I'll inadvertently leave something identifying. And the header seems massive. But I'll post the message ID bit that mentions mailchimp. I don't know if that will help, sorry. If you could tell me if this could be weaved into a sieve rule I'd be grateful


Quote:
Message-ID: <152059ab[email protected]mail70.atl31.mcdlv.net>
X-Mailer: MailChimp Mailer - **CID2fd97ca2db05035a2d5d**
X-Campaign: mailchimp152059abb172ad0a48146755e.2fd97ca2db
X-campaignid: mailchimp152059abb172ad0a48146755e.2fd97ca2db
Would this work, feel free to laugh if it is badly wrong

if header :contains "X-Mailer" ["MailChimp"]

{reject }

Last edited by ferrety : 15 Dec 2018 at 02:46 PM.
ferrety is offline   Reply With Quote
Old 15 Dec 2018, 03:33 PM   #5
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 2,751
You can create a rule based on the To alias and the X-Mailer header.

Go to Settings->Rules, click New rule, and use
Code:
If all of the following conditions apply
Any recipient email  is exactly  <the desired alias>
(Add condition)
Code:
A header called  X-Mailer  begins with  MailChimp Mailer
Under Action select
Permanently delete the message

Then click Save
BritTim is offline   Reply With Quote
Old 15 Dec 2018, 05:19 PM   #6
ferrety
Member
 
Join Date: Mar 2018
Posts: 48
Quote:
Originally Posted by BritTim View Post
You can create a rule based on the To alias and the X-Mailer header.

Go to Settings->Rules, click New rule, and use
Code:
If all of the following conditions apply
Any recipient email  is exactly  <the desired alias>
(Add condition)
Code:
A header called  X-Mailer  begins with  MailChimp Mailer
Under Action select
Permanently delete the message

Then click Save
Thanks Tim appreciated would you be willing to give me the sieve script for it?
ferrety is offline   Reply With Quote
Old 15 Dec 2018, 05:33 PM   #7
ferrety
Member
 
Join Date: Mar 2018
Posts: 48
Quote:
Originally Posted by BritTim View Post
You can create a rule based on the To alias and the X-Mailer header.

Go to Settings->Rules, click New rule, and use
Code:
If all of the following conditions apply
Any recipient email  is exactly  <the desired alias>
(Add condition)
Code:
A header called  X-Mailer  begins with  MailChimp Mailer
Under Action select
Permanently delete the message

Then click Save
Thanks Tim appreciated would you be willing to give me the sieve script for it? Also I'm trying to learn so if I wanted to stop mailchimp sending to all emails (rather than a specific alias) would this be correct?


Quote:
if header :contains ["X-Mailer"] ["MailChimp"]

{discard; stop;}
ferrety is offline   Reply With Quote
Old 15 Dec 2018, 07:56 PM   #8
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 2,751
Quote:
Originally Posted by ferrety View Post
Thanks Tim appreciated would you be willing to give me the sieve script for it?
Usually, the best way of figuring out the sieve code for something that can be done using a Rule is to
  • Create the Rule
  • Go to Edit custom sieve code (see bottom right of the page)
  • Find the sieve code associated with the Rule you just created.
  • Copy the code.
  • Cancel to exit from Custom Sieve and delete the Rule you created temporarily.
Doing this for your problem, you get
Code:
if 
  allof(
  address :is ["To","Cc","Resent-To","X-Delivered-To"] "[email protected]",
  header :matches "X-Mailer" "MailChimp Mailer*"
  )
{
  discard;
  stop;
}
BritTim is offline   Reply With Quote
Old 17 Dec 2018, 05:16 PM   #9
xyzzy
Member
 
Join Date: May 2018
Posts: 82
I do what was just described. But I always keep the rule disabled at the start of the list of rules to make it easier to spot in the sieve script. It will be the first rule that's is always commented out. No need to go back and delete it.
xyzzy is offline   Reply With Quote
Old 17 Dec 2018, 05:29 PM   #10
ferrety
Member
 
Join Date: Mar 2018
Posts: 48
Quote:
Originally Posted by BritTim View Post
Usually, the best way of figuring out the sieve code for something that can be done using a Rule is to
  • Create the Rule
  • Go to Edit custom sieve code (see bottom right of the page)
  • Find the sieve code associated with the Rule you just created.
  • Copy the code.
  • Cancel to exit from Custom Sieve and delete the Rule you created temporarily.
Doing this for your problem, you get
Code:
if 
  allof(
  address :is ["To","Cc","Resent-To","X-Delivered-To"] "MyAlia[email protected]",
  header :matches "X-Mailer" "MailChimp Mailer*"
  )
{
  discard;
  stop;
}
Hi Tim
Really appreciate your knowledge here
Will the script I wrote fail, if so what about it have I messed up. Again forgetting aliases (so as to make it less complicated)?

PS I signed up for a free mailchimp account (giving the spammy gits no private info) I used an alias email & sent my self test emails while fiddling with sieve script. To test if my script was stopping them.
It only started stopping them when I set it like below
Quote:
if header :contains ["X-Mailer"] ["MailChimp"]

{discard; stop;}
ferrety is offline   Reply With Quote
Old 18 Dec 2018, 03:46 PM   #11
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 2,751
Quote:
Originally Posted by ferrety View Post
Hi Will the script I wrote fail, if so what about it have I messed up. Again forgetting aliases (so as to make it less complicated)?
Your simpler version will likely not have issues. However, it is best not to be sloppy with things like sieve code, and be very specific in the conditions you want to test. People have often run into trouble in the past by having their rules unexpectedly match something other than what was intended. You probably do not need to change your code here. However, for the future, I would recommend using Rules or (if, for some reason you cannot in a specific situation) being very careful and specific about your tests.
BritTim is offline   Reply With Quote
Old 18 Dec 2018, 11:33 PM   #12
ferrety
Member
 
Join Date: Mar 2018
Posts: 48
Quote:
Originally Posted by BritTim View Post
Your simpler version will likely not have issues. However, it is best not to be sloppy with things like sieve code, and be very specific in the conditions you want to test. People have often run into trouble in the past by having their rules unexpectedly match something other than what was intended. You probably do not need to change your code here. However, for the future, I would recommend using Rules or (if, for some reason you cannot in a specific situation) being very careful and specific about your tests.
Really appreciate the advice, I wish there was an ebook sieve for dummies on it. I find it fascinating but don't really understand it. Thus the sloppy script
ferrety is offline   Reply With Quote
Old 19 Dec 2018, 02:33 AM   #13
janusz
The "e" in e-mail
 
Join Date: Feb 2006
Location: EU
Posts: 4,629
https://www.howtoforge.com/sieve_mail_filtering
janusz is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 05:11 AM.

 

Copyright EmailDiscussions.com 1998-2013. All Rights Reserved. Privacy Policy