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 5 Nov 2013, 12:42 AM   #1
apl
Senior Member
 
Join Date: Apr 2006
Location: London, England
Posts: 166
Sieve forwarding rules

Hi,

Can anyone help guide me through some issues I'm having using the forwarding rules and Sieve in the advanced popup.

I have a few address book groups defined which add a header to inbound email that shows what address group if any that they matched:

Code:
X-Spam-known-sender: yes, "Family"
An email from a matching address in the Family group will contain that header, I use this to post a notification to my Inbox that an email has arrived from a family member. The iPhone only notifies you of email in the Inbox and the family based email messages are filed by the server into folders.

The trigger on this rule looks like this:

Code:
header :contains "X-Spam-known-sender" "Family"
The rest of the forward rule looks like this:

Code:
notify :method "mailto" :options ["me@domain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"
This works apart from the fact that I have several of these running and it seems to trigger all of them. I have tried several different ways to construct the first part so that it matches the header string but can't get the syntax right.I'm guessing that the :contains is matching the header so any email with that header triggers the notify script?

Strangely, I use a similar File into Folders rule for all the miscellaneous email that I want to see but not in my Inbox, that uses the following syntax:

Code:
header:contains"X-Spam-known-sender" "Miscellaneous"
Again, Miscellaneous is just an address book group containing those email addresses.

If anyone can help out I'd be most grateful.

Regards Alan
apl is offline   Reply With Quote

Old 11 Nov 2013, 08:06 AM   #2
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,917
First, remember that the Advanced rules tab only creates Sieve when you log into the beta interface. You can read email and perform other tasks while logged into the normal interface, but if you change any settings screen you may create a new automatic Sieve without your Advanced tweaks. The Advanced custom Sieve rules are not deleted but just disabled, and you can log back into beta and apply your rules to get them activated again.

I just tried this simple Advanced tab beta rule and it worked correctly:
Code:
### Start {{{
if header :contains ["X-Spam-known-sender"] "Family"
 {
  fileinto "INBOX.test";
  stop;
}
### }}}
I also have a Family address book group and use a "test" folder. If you create a personality with an email address containing only * for the local-part (such as *@fastmail.fm), you will be able to select it and then access an editable From field in the current interface. This means I can spoof a family member From address and test my rule. It files into the test folder properly.

I don't understand what is failing for you. If multiple actions are being triggering improperly, you may have your if..elseif blocks not set up properly, or you may need to add stop commands. Or you may have an address in more than one address group, so that several of the address book rules are triggered.

Bill
n5bb is offline   Reply With Quote
Old 11 Nov 2013, 08:41 AM   #3
apl
Senior Member
 
Join Date: Apr 2006
Location: London, England
Posts: 166
Hello Bill

Thanks for your reply, here's the section that is failing, it is configured via the advanced popup for forwarding rules, I'm not keying anything in:

Code:
if header :is "X-Spam-known-sender" "yes, \"Photographic Club\"" {
  notify :method "mailto" :options ["myaddress@mydomain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"; stop;
}
if header :is "X-Spam-known-sender" "yes, \"Friends\"" {
  notify :method "mailto" :options ["myaddress@mydomain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"; stop;
}
if header :is "X-Spam-known-sender" "yes, \"Family\"" {
  notify :method "mailto" :options ["myaddress@mydomain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"; stop;
}
if header :is "X-Spam-known-sender" "yes, \"OmniFocus\"" {
  notify :method "mailto" :options ["myaccount@sync.omnigroup.com","Text","Only"] :message "/ $subject$ /"; stop;
}
If an email is sent from an address that matches the Friends group then I get an alert as expected, but I also get a match on the last item which ends up in my OmniFocus InBox.

Thinking about this further it may be a mail loop, the alert comes into my Fastmail In Box which will run through the rules again, it may be that I have a match occurring that I can't see.

As it stands I really don't understand why it matches twice other than an issue with the email address or a loop.

Regards Alan
apl is offline   Reply With Quote
Old 11 Nov 2013, 11:37 AM   #4
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,917
Exclamation Message loops

I have an idea about the cause of your difficulty, Alan.
  • When the original message arrives and triggers the Friends group rule, a notification message is sent from your account. This notification message is sent with From set to the address in your default personality.
  • The notification message then arrives back at your account. My guess is that your default personality address is in the OmniFocus group. So that message triggers the last rule and sends a notification message (with From set to your default personality) to the omnigroup.com address.
    • I believe that this second message should have a longer subject line, since the second pass concatenates addition information to the start of the subject.
  • You need to be careful about such email loops. Fastmail has a safety feature using the Message-Id header (and in some cases additions to the Subject header, I believe) to prevent most types of infinite message loops. But I'm not sure if the notification message is protected from such such safety features, since a new message with a new Message-Id and Subject is created.
  • So you really need to be sure that your default personality address isn't found in any of the groups creating these notification triggers. And you might place an explicit trap to prevent your address triggering these notifications, such as:
Code:
if not header :contains "from" "mypersonality@mydomain" {
  if header :is "X-Spam-known-sender" "yes, \"Photographic Club\""
    {   notify :method "mailto" :options ["myaddress@mydomain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"; stop; }
  if header :is "X-Spam-known-sender" "yes, \"Friends\"" 
    {   notify :method "mailto" :options ["myaddress@mydomain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"; stop; }
   if header :is "X-Spam-known-sender" "yes, \"Family\"" 
    {   notify :method "mailto" :options ["myaddress@mydomain.com","Text","Only"] :message "- / From: $from$ Subject: $subject$ / Mail Alert: from $from$. Subject $subject$"; stop; }
   if header :is "X-Spam-known-sender" "yes, \"OmniFocus\"" 
    {   notify :method "mailto" :options ["myaccount@sync.omnigroup.com","Text","Only"] :message "/ $subject$ /"; stop; }
}
Bill
n5bb is offline   Reply With Quote
Old 12 Nov 2013, 04:32 PM   #5
apl
Senior Member
 
Join Date: Apr 2006
Location: London, England
Posts: 166
Hello Bill,

Well spotted, that was the issue, thanks. I've accidentally created mail loops before and they do have a limiter although it's quite high before it stops the scripts from running.

One of the test users in the OmniFocus address group contained my primary address as a second address which was causing it to match a second time.

Regards Alan
apl 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 03:39 PM.

 

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