|
FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc. |
|
Thread Tools |
15 Jan 2015, 12:01 PM | #1 |
Senior Member
Join Date: Oct 2003
Posts: 102
|
How to use Sieve to detect an empty To address
This doesn't work:
Code:
if header :is ["To"] [""] { ... do something } |
15 Jan 2015, 01:49 PM | #2 |
The "e" in e-mail
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,092
|
Code:
if not exists "to" { whatever } |
17 Jan 2015, 03:32 AM | #3 |
Senior Member
Join Date: Oct 2003
Posts: 102
|
Thanks, I learned a new Sieve keyword.
|
17 Jan 2015, 11:16 AM | #4 |
Intergalactic Postmaster
Join Date: May 2004
Location: Irving, Texas
Posts: 8,927
|
A more complex alternative
That rule will correctly find messages which don't contain a To header, and it it works for you it's the best since it is so simple. But remember that this doesn't mean that the messages it catches always come from that specific person sending BCC messages to you.
Code:
if allof ( header :contains "from" ["sender1@xx","sender2@xx"], not header :contains ["to", "cc"] ["youradr1@xx","youradr2@xx"] ) { whatever } Code:
"sender@xx" ["sender1@xx","sender2@yy","sender3@zz"] |
18 Jan 2015, 06:34 AM | #5 |
Senior Member
Join Date: Oct 2003
Posts: 102
|
I am using something like this:
Code:
if allof (not exists ["To"], header :contains ["From"] ["someoneOrOther"]) { <file away silently>; } else { <file somewhere I will notice>; } While I am asking sieve questions, I am using Notepad++ and saving it as a C file; this works OK for comments, strings, and matching brackets, but it's not so good for keywords. Notepad++ is a nice editor but there is no plugin for Sieve. It is also possible to customize it with keywords, but I have not done that and I wasn't able to find anyone else who had either. Does anyone have a Sieve editor suggestion? |
18 Jan 2015, 09:12 AM | #6 |
The "e" in e-mail
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,092
|
Not really. There is an old sieve syntax file for vim available at https://github.com/vim-scripts/sieve.vim, but I personally would not want to do much work these days in vim. Also, as I recall, it only syntax highlights core sieve keywords. It has no support for the many extensions used these days.
My code editor of choice is Komodo (based on Scintilla). It would be pretty easy to add sieve syntax support, but I have never bothered. |