.mailfilter 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. ### Village associatif (Solution Linux)
  40. if (/^List-Id: .*<village-assoces\.lists\.parinux\.org>.*$/)
  41. to $MAILDIR/.my.ml.village-asso
  42. ### Kde Lists
  43. if (/^List-Id: .*<!.*!\.kde\.org>.*$/)
  44. {
  45. exception {
  46. `test -d $MAILDIR/.my.ml.kde.$MATCH2`
  47. if( $RETURNCODE == 1 )
  48. `$MAILDIRMAKE $MAILDIR/.my.ml.kde.$MATCH2`
  49. to $MAILDIR/.my.ml.kde.$MATCH2
  50. }
  51. }
  52. ### Hurd France Lists
  53. if (/^List-Id:.*<hurdfr\.hurdfr\.org>$/)
  54. to $MAILDIR/.my.ml.hurd.hurdfr
  55. ### Asyd Lists
  56. if (/^List-Id:.*mailman\.asyd\.net>.*$/)
  57. to $MAILDIR/
  58. if (/^List-Id:.*<!.*!\.asyd\.net>.*$/)
  59. to $MAILDIR/.my.ml.asyd.$MATCH2
  60. ### Galette Lists
  61. if (/^List-Id:.*<galette-!.*!\.gna\.org>.*$/)
  62. to $MAILDIR/.my.soft.galette.$MATCH2
  63. ### Abul Lists
  64. if (/^List-Id:.*<!.*!\.abul\.org>.*$/)
  65. {
  66. exception {
  67. `test -d $MAILDIR/.my.ml.abul.$MATCH2`
  68. if( $RETURNCODE == 1 )
  69. `$MAILDIRMAKE $MAILDIR/.my.ml.abul.$MATCH2`
  70. to $MAILDIR/.my.ml.abul.$MATCH2
  71. }
  72. }
  73. ### Aquitaine libre lists
  74. if (/^List-Id:.*<!.*!\.listes\.aquitaine-libre\.info>.*$/)
  75. {
  76. exception {
  77. `test -d $MAILDIR/.my.ml.al.$MATCH2`
  78. if( $RETURNCODE == 1 )
  79. `$MAILDIRMAKE $MAILDIR/.my.ml.al.$MATCH2`
  80. to $MAILDIR/.my.ml.al.$MATCH2
  81. }
  82. }
  83. ### WeeChat Lists
  84. if (/^List-Id:.*weechat-!.*!\.nongnu\.org.*$/ || /^To:.*weechat-!.*!\.nongnu.org\.*$/)
  85. to $MAILDIR/.my.soft.weechat.ml.$MATCH2
  86. ### Sympa Stuff
  87. if (/^From:.*SYMPA/ || /^To:.*sympa-request@.*$/)
  88. {
  89. to $MAILDIR/.sys.sympa
  90. }
  91. ### Logs Stuff
  92. if (/^From:.*logcheck@/ || /^Subject:.*rkhunter/ || /^Subject:.*Logwatch for/)
  93. to $MAILDIR/.sys.reports
  94. ### Tiac Info
  95. if (/^Subject:.*[tT][iI][aA][cC].*[iI][nN][fF][oO]/)
  96. {
  97. to $MAILDIR/.friends.tbs.tiacfooting
  98. }
  99. ### Spam
  100. CRMSCORE=`grep -a -v "^X-CRM114" | crm -u $HOME/.crm/ /usr/share/crm114/mailfilter.crm --stats_only`
  101. xfilter "formail -I \"X-CRM114-Score: $CRMSCORE\""
  102. if ($CRMSCORE < -1)
  103. {
  104. xfilter "formail -I \"X-CRM114-Spam: yes\""
  105. }
  106. #log "Spam: $CRMSCORE"
  107. #if (/^X-CRM114-Spam: yes/)
  108. #{
  109. # to $MAILDIR/.Spam
  110. #}
  111. #xfilter "spamc"
  112. if (/^X-Spam-Status: YES/)
  113. {
  114. to $MAILDIR/.Spam
  115. }
  116. if (!/^From:.*/ || /^Subject:.*\[\*\*SPAM\*\*\].*/)
  117. to $MAILDIR/.Spam
  118. ########### INBOX ###############
  119. to $MAILDIR/