EmailDiscussions.com  

Go Back   EmailDiscussions.com > Email Service Provider-specific Forums > FastMail Forum
Register FAQ Members List Calendar Today's Posts
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 6 Mar 2015, 08:02 AM   #1
miguelm
Member
 
Join Date: Sep 2006
Posts: 49
fastmail sieve script not working

Hello,

on my fastmail member account, the sieve script is not working, I have used the fastmail interface that automatically generated this script:

require ["envelope", "imapflags", "fileinto", "reject", "notify", "vacation", "regex", "relational", "comparator-i;ascii-numeric", "body", "copy"];

if anyof(
header :contains "from" "domain1.com",
header :contains "from" "domain2.com",
header :contains "from" "domain3.com",
header :contains "from" "domain4.com",
header :contains "from" "domain5.com",
header :contains "from" "domain6.com"
) {
discard;
stop;
}
if true {
redirect :copy "myemailg@gmail.com";
}


but, I still get the emails from the above domains on my inbox

I have used the sieve script test of fastmail, and it discard the messages fine

so what can be wrong?

Thank you
miguelm is offline   Reply With Quote

Old 6 Mar 2015, 11:15 AM   #2
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,929
Arrow Script works for me

I tried a version of your script and it worked perfectly for me. Be sure to check the full headers of a message which was not discarded and look at the actual From header contents.

Bill
n5bb is offline   Reply With Quote
Old 7 Mar 2015, 02:58 AM   #3
miguelm
Member
 
Join Date: Sep 2006
Posts: 49
Quote:
Originally Posted by n5bb View Post
I tried a version of your script and it worked perfectly for me. Be sure to check the full headers of a message which was not discarded and look at the actual From header contents.

Bill
Bill,

for me the script does not work at all on my member account, but it does work on the Enhance account. I have tried again with this:

require ["envelope", "imapflags", "fileinto", "reject", "notify", "vacation", "regex", "relational", "comparator-i;ascii-numeric", "body", "copy"];

if anyof(
header :contains "from" "myemailg@gmail.com",
) {
discard;
stop;
}
if true {
redirect :copy "myemail@fastmail.com";
}

them I have sent an email from my myemailg@gmail.com to the fastmail member account and it goes to the inbox instead of being discard

do you have any suggestion?

thank you
miguelm is offline   Reply With Quote
Old 7 Mar 2015, 10:30 AM   #4
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,929
Here is the simple script I'm using. It works on both a Member and a Lite account.
Code:
require ["envelope", "imapflags", "fileinto", "reject", "notify", "vacation", "regex", "relational", "comparator-i;ascii-numeric", "body", "copy"];

if anyof(
header :contains "from" "mydomain.net",
header :contains "from" "domain1.com"
) {
discard;
stop;
}
Messages with From set to addresses such as "test@mydomain.net" or "test@domain1.com" are silently discarded and not delivered to the account.

Be sure you Apply your Sieve changes or they will not be used. If you get any errors at the top of the screen your script will not be used - you should see "Advanced rules saved" near the top center after clicking "Apply all changes".

Please be sure to check the From header in the Raw Message. If you have a Guest account you can't use a full custom Sieve script, but Member and higher level accounts support custom Sieve.

Bill
n5bb is offline   Reply With Quote
Old 7 Mar 2015, 04:05 PM   #5
miguelm
Member
 
Join Date: Sep 2006
Posts: 49
Bill,

it did work

so the problem is only the redirect, the difference I can see in both codes is only the redirect, does this mean I can't redirect? or can you see any issue in the redirect code?

thank you
miguelm is offline   Reply With Quote
Old 8 Mar 2015, 11:42 AM   #6
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,929
Quote:
Originally Posted by miguelm View Post
...it did work ... so the problem is only the redirect, the difference I can see in both codes is only the redirect, does this mean I can't redirect? or can you see any issue in the redirect code?
If I add a redirect (either to a different email account as in your first example, or to the same account as in your last example), it still works properly.
  • When the incoming message From header contains "mydomain.net" or "domain1.com", the message is discarded and no forwarding occurs.
  • When the incoming message From header does not include a match to those specific domains, the message is delivered to the Inbox of this Fastmail account.
    • If you are forwarding to another account, a copy is also sent to that external email address.
    • If you are forwarding to your own account running the script (as you are apparently doing in your last example), the redirected message won't be delivered since it would produce a duplicate identical message in your Inbox, and by default duplicate messages are suppressed - see the Advanced>Folders screen setup for Inbox.
Bill
n5bb is offline   Reply With Quote
Old 10 Mar 2015, 02:22 PM   #7
Terry
The "e" in e-mail
 
Join Date: Jul 2002
Location: VK4
Posts: 3,028
Surly you have to take out the stop; for the rest of the rules to work ?
Terry is offline   Reply With Quote
Old 11 Mar 2015, 07:33 AM   #8
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,929
Quote:
Originally Posted by Terry View Post
Surly you have to take out the stop; for the rest of the rules to work ?
No, if you take out the stop it will not work correctly. You want to ignore any later Sieve steps if the test passes and the message is discarded, and only execute later steps if the test fails and the message is not discarded. For example, the normal spam filter files bad messages into the Junk Mail folder, then stops. Messages which have a low spam score are ignored by this code:
Code:
if  header :value "ge" :comparator "i;ascii-numeric" ["X-Spam-score"] ["5"]  {
  fileinto "INBOX.Junk Mail";
  stop;
}
Bil
n5bb is offline   Reply With Quote
Old 11 Mar 2015, 02:30 PM   #9
Terry
The "e" in e-mail
 
Join Date: Jul 2002
Location: VK4
Posts: 3,028
Ok thanks.....yes I understand also did not realise it had file into junk mail....
Terry is offline   Reply With Quote
Old 12 Mar 2015, 09:04 AM   #10
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,929
It's an "if ... then ..." conditional execution programming structure.
  • If the "if" part is satisfied (true), then the part in the curly brackets { } is executed.
  • Otherwise the part in the { } brackets is ignored and later Sieve steps are executed.
In this case, we want to discard a message (or file it into the spam folder) only when certain conditions have been met, and we want to then stop execution and ignore any later code.

Bill
n5bb is offline   Reply With Quote
Reply



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 09:26 PM.

 

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