本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.3KB

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