Sieve

Sieve は、電子メールフィルタリングのためのプログラミング言語。Cyrus IMAP server を開発したカーネギーメロン大学の Cyr…

Sieve

Sieve は、電子メールフィルタリングのためのプログラミング言語Cyrus IMAP server を開発したカーネギーメロン大学の Cyrus Project で開発された。

特定のオペレーティングシステムやメールアーキテクチャに依存していない。RFC 2822 準拠メッセージである必要はある。Sieve の基本仕様は RFC 5228 (2008年1月発行)で概説されている。

Sieve は普通のプログラミング言語とは違ってフィルタリングに限定されており、基本仕様では変数もループもない。拡張として、変数を導入したり、限定的なループを導入したりしているが、まだ言語としては非常に制限されており、メールシステムの一部としてユーザーが記述したプログラムを導入するのに適している。

言語の文法には多数の制限があり、構文解析を単純化しているが、文字列の地域化もいくつかの方法でサポートしていて、Unicodeも完全に扱える。

Sieve のスクリプトの例を以下に示す。

# example script
# de.wikipedia.org
#
require ["fileinto", "reject"];

# 100KB以上のメッセージは拒否し、エラーメッセージを表示
#

if size :over 100K {
   reject "I'm sorry, I do not accept mail over 100kb in size. 
Please upload larger files to a server and send me a link.
Thanks.";
}

# メーリングリストからのメールは "mailinglist" というフォルダに格納
#

elsif address :is ["From", "To"] "[email protected]" {
   fileinto "INBOX.mailinglist";
}

# スパム規則: To, CC, Bcc ヘッダに自分のアドレスがないメッセージ
# および、subject に "money" や "Viagra" という単語のあるメッセージ
#

elsif anyof (not address :all :contains ["To", "Cc", "Bcc"] "[email protected]", 
header :matches "Subject" ["*money*","*Viagra*"]) {
      fileinto "INBOX.spam";
}

# 他はキープする。
# この部分はなくてもよい(デフォルトでキープされる)

else {
     keep;
}

外部リンク

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.