0
|
1 <!doctype html>
|
|
2
|
|
3 <title>CodeMirror: Sieve (RFC5228) mode</title>
|
|
4 <meta charset="utf-8"/>
|
|
5 <link rel=stylesheet href="../../doc/docs.css">
|
|
6
|
|
7 <link rel="stylesheet" href="../../lib/codemirror.css">
|
|
8 <script src="../../lib/codemirror.js"></script>
|
|
9 <script src="sieve.js"></script>
|
|
10 <style>.CodeMirror {background: #f8f8f8;}</style>
|
|
11 <div id=nav>
|
|
12 <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
|
13
|
|
14 <ul>
|
|
15 <li><a href="../../index.html">Home</a>
|
|
16 <li><a href="../../doc/manual.html">Manual</a>
|
|
17 <li><a href="https://github.com/codemirror/codemirror">Code</a>
|
|
18 </ul>
|
|
19 <ul>
|
|
20 <li><a href="../index.html">Language modes</a>
|
|
21 <li><a class=active href="#">Sieve (RFC5228)</a>
|
|
22 </ul>
|
|
23 </div>
|
|
24
|
|
25 <article>
|
|
26 <h2>Sieve (RFC5228) mode</h2>
|
|
27 <form><textarea id="code" name="code">
|
|
28 #
|
|
29 # Example Sieve Filter
|
|
30 # Declare any optional features or extension used by the script
|
|
31 #
|
|
32
|
|
33 require ["fileinto", "reject"];
|
|
34
|
|
35 #
|
|
36 # Reject any large messages (note that the four leading dots get
|
|
37 # "stuffed" to three)
|
|
38 #
|
|
39 if size :over 1M
|
|
40 {
|
|
41 reject text:
|
|
42 Please do not send me large attachments.
|
|
43 Put your file on a server and send me the URL.
|
|
44 Thank you.
|
|
45 .... Fred
|
|
46 .
|
|
47 ;
|
|
48 stop;
|
|
49 }
|
|
50
|
|
51 #
|
|
52 # Handle messages from known mailing lists
|
|
53 # Move messages from IETF filter discussion list to filter folder
|
|
54 #
|
|
55 if header :is "Sender" "owner-ietf-mta-filters@imc.org"
|
|
56 {
|
|
57 fileinto "filter"; # move to "filter" folder
|
|
58 }
|
|
59 #
|
|
60 # Keep all messages to or from people in my company
|
|
61 #
|
|
62 elsif address :domain :is ["From", "To"] "example.com"
|
|
63 {
|
|
64 keep; # keep in "In" folder
|
|
65 }
|
|
66
|
|
67 #
|
|
68 # Try and catch unsolicited email. If a message is not to me,
|
|
69 # or it contains a subject known to be spam, file it away.
|
|
70 #
|
|
71 elsif anyof (not address :all :contains
|
|
72 ["To", "Cc", "Bcc"] "me@example.com",
|
|
73 header :matches "subject"
|
|
74 ["*make*money*fast*", "*university*dipl*mas*"])
|
|
75 {
|
|
76 # If message header does not contain my address,
|
|
77 # it's from a list.
|
|
78 fileinto "spam"; # move to "spam" folder
|
|
79 }
|
|
80 else
|
|
81 {
|
|
82 # Move all other (non-company) mail to "personal"
|
|
83 # folder.
|
|
84 fileinto "personal";
|
|
85 }
|
|
86 </textarea></form>
|
|
87 <script>
|
|
88 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
|
89 </script>
|
|
90
|
|
91 <p><strong>MIME types defined:</strong> <code>application/sieve</code>.</p>
|
|
92
|
|
93 </article>
|