1
0

index.html 2.0 KB

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