.mailfilter 2.9 KB

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