.mailfilter 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # .Mailfilter - rules for maildrop
  2. HOME="/home/manu"
  3. MAILDIR="$HOME/Mail/imap"
  4. MAILDIRMAKE="/usr/bin/maildirmake"
  5. VERBOSE=9
  6. MAILDROP_OLD_REGEXP=1
  7. logfile "/home/manu/var/logs/maildrop/maildrop.log"
  8. ### Rmll Lists
  9. if (/^X-BeenThere: !.*!@rmll\.info.*$/)
  10. {
  11. exception {
  12. `test -d $MAILDIR/.my.ml.rmll.$MATCH2`
  13. if( $RETURNCODE == 1 )
  14. `$MAILDIRMAKE $MAILDIR/.my.ml.rmll.$MATCH2`
  15. to $MAILDIR/.my.ml.rmll.$MATCH2
  16. }
  17. }
  18. if (/^From:.*reservation@rmll\.info.*$/)
  19. to $MAILDIR/.my.ml.rmll.resa
  20. ### Debian Lists
  21. if (/^List-Id: <debian-!.*!\.lists\.debian\.org>.*$/)
  22. {
  23. exception {
  24. `test -d $MAILDIR/.my.ml.debian.$MATCH2`
  25. if( $RETURNCODE == 1 )
  26. `$MAILDIRMAKE $MAILDIR/.my.ml.debian.$MATCH2`
  27. to $MAILDIR/.my.ml.debian.$MATCH2
  28. }
  29. }
  30. ## Debian backports
  31. if (/^List-Id:.*<backports-users\.lists\.backports\.org>$/)
  32. to $MAILDIR/.my.ml.debian.backports
  33. ### Debian France Lists
  34. if (/^List-Id: <!.*!\.france\.debian\.net>.*$/)
  35. to $MAILDIR/.my.ml.debian.france.$MATCH2
  36. ### Debian Alioth Projects
  37. if (/^List-Id: .*<pkg-phototools-devel\.lists\.alioth\.debian\.org>.*$/)
  38. to $MAILDIR/.my.soft.debian.pkg.phototools
  39. ### Kde Lists
  40. if (/^List-Id: .*<!.*!\.kde\.org>.*$/)
  41. {
  42. exception {
  43. `test -d $MAILDIR/.my.ml.kde.$MATCH2`
  44. if( $RETURNCODE == 1 )
  45. `$MAILDIRMAKE $MAILDIR/.my.ml.kde.$MATCH2`
  46. to $MAILDIR/.my.ml.kde.$MATCH2
  47. }
  48. }
  49. ### Hurd France Lists
  50. if (/^List-Id:.*<hurdfr\.hurdfr\.org>$/)
  51. to $MAILDIR/.my.ml.hurd.hurdfr
  52. ### Asyd Lists
  53. if (/^List-Id:.*mailman\.asyd\.net>.*$/)
  54. to $MAILDIR/
  55. if (/^List-Id:.*<!.*!\.asyd\.net>.*$/)
  56. to $MAILDIR/.my.ml.asyd.$MATCH2
  57. ### Galette Lists
  58. if (/^List-Id:.*<galette-!.*!\.gna\.org>.*$/)
  59. to $MAILDIR/.my.soft.galette.$MATCH2
  60. ### Abul Lists
  61. if (/^List-Id:.*<!.*!\.abul\.org>.*$/)
  62. {
  63. exception {
  64. `test -d $MAILDIR/.my.ml.abul.$MATCH2`
  65. if( $RETURNCODE == 1 )
  66. `$MAILDIRMAKE $MAILDIR/.my.ml.abul.$MATCH2`
  67. to $MAILDIR/.my.ml.abul.$MATCH2
  68. }
  69. }
  70. ### Aquitaine libre lists
  71. if (/^List-Id:.*<!.*!\.listes\.aquitaine-libre\.info>.*$/)
  72. {
  73. exception {
  74. `test -d $MAILDIR/.my.ml.al.$MATCH2`
  75. if( $RETURNCODE == 1 )
  76. `$MAILDIRMAKE $MAILDIR/.my.ml.al.$MATCH2`
  77. to $MAILDIR/.my.ml.al.$MATCH2
  78. }
  79. }
  80. ### WeeChat Lists
  81. if (/^List-Id:.*weechat-!.*!\.nongnu\.org.*$/ || /^To:.*weechat-!.*!\.nongnu.org\.*$/)
  82. to $MAILDIR/.my.soft.weechat.ml.$MATCH2
  83. ### Sympa Stuff
  84. if (/^From:.*SYMPA/)
  85. {
  86. to $MAILDIR/.sys.sympa
  87. }
  88. ### Logs Stuff
  89. if (/^From:.*logcheck@/ || /^Subject:.*rkhunter/ || /^Subject:.*Logwatch for/)
  90. to $MAILDIR/.sys.reports
  91. ### Tiac Info
  92. if (/^Subject:.*[tT][iI][aA][cC].*[iI][nN][fF][oO]/)
  93. {
  94. to $MAILDIR/.friends.tbs.tiacfooting
  95. }
  96. ### Spam
  97. CRMSCORE=`grep -a -v "^X-CRM114" | crm -u $HOME/.crm/ /usr/share/crm114/mailfilter.crm --stats_only`
  98. xfilter "formail -I \"X-CRM114-Score: $CRMSCORE\""
  99. if ($CRMSCORE < -1)
  100. {
  101. xfilter "formail -I \"X-CRM114-Spam: yes\""
  102. }
  103. #log "Spam: $CRMSCORE"
  104. #if (/^X-CRM114-Spam: yes/)
  105. #{
  106. # to $MAILDIR/.Spam
  107. #}
  108. #xfilter "spamc"
  109. if (/^X-Spam-Status: YES/)
  110. {
  111. to $MAILDIR/.Spam
  112. }
  113. if (!/^From:.*/ || /^Subject:.*\[\*\*SPAM\*\*\].*/)
  114. to $MAILDIR/.Spam
  115. ########### INBOX ###############
  116. to $MAILDIR/