.mailfilter 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. # .mailfilter - rules for maildrop
  2. HOME="/home/manu"
  3. MAILDIR="$HOME/Mail/imap"
  4. MAILDIRMAKE="/usr/bin/maildirmake"
  5. VERBOSE=9
  6. logfile "/home/manu/var/logs/maildrop/maildrop.log"
  7. ### Rmll Lists (2009 and previous)
  8. if (/^X-BeenThere:\s*(.*)@rmll\.info/)
  9. {
  10. exception {
  11. `test -d $MAILDIR/.rmll.09.$MATCH1`
  12. if( $RETURNCODE == 1 )
  13. `$MAILDIRMAKE $MAILDIR/.rmll.09.$MATCH1`
  14. to $MAILDIR/.rmll.09.$MATCH1
  15. }
  16. }
  17. if (/^From:.*reservation@rmll\.info/)
  18. {
  19. to $MAILDIR/.rmll.09.resa
  20. }
  21. ### Debian Lists
  22. if (/^List-Id:\s*<debian-(.*)\.lists\.debian\.org>/)
  23. {
  24. exception {
  25. `test -d $MAILDIR/.debian.$MATCH1`
  26. if( $RETURNCODE == 1 )
  27. `$MAILDIRMAKE $MAILDIR/.debian.$MATCH1`
  28. to $MAILDIR/.debian.$MATCH1
  29. }
  30. }
  31. if (/^List-Id:.*<backports-users\.lists\.backports\.org>/)
  32. {
  33. to $MAILDIR/.debian.backports
  34. }
  35. ### Debian France Lists
  36. if (/^List-Id:\s*<(.*)\.france\.debian\.net>/)
  37. {
  38. to $MAILDIR/.debian-france.$MATCH1
  39. }
  40. ### Debian Alioth Projects
  41. if (/^List-Id:.*<(.*)\.lists\.alioth\.debian\.org>/)
  42. {
  43. exception {
  44. `test -d $MAILDIR/.debian.alioth.$MATCH1`
  45. if( $RETURNCODE == 1 )
  46. `$MAILDIRMAKE $MAILDIR/.debian.alioth.$MATCH1`
  47. to $MAILDIR/.debian.alioth.$MATCH1
  48. }
  49. }
  50. ### Village associatif (Solution Linux)
  51. if (/^List-Id:.*<(.*)\.lists\.parinux\.org>/)
  52. {
  53. to $MAILDIR/.groups.$MATCH1
  54. }
  55. ### FrNog
  56. if (/^List-Id: .*frnog=FRnOG\.org/)
  57. {
  58. to $MAILDIR/.groups.frnog
  59. }
  60. ### Hurd France Lists
  61. if (/^List-Id:.*<hurdfr\.hurdfr\.org>/)
  62. {
  63. to $MAILDIR/.groups.hurd-fr
  64. }
  65. ### Asyd Lists
  66. if (/^List-Id:.*mailman\.asyd\.net>/)
  67. {
  68. to $MAILDIR/.logs
  69. }
  70. if (/^List-Id:.*<(.*)\.asyd\.net>/)
  71. {
  72. to $MAILDIR/.groups.asyd_$MATCH1
  73. }
  74. ### Abul Lists
  75. if (/^List-Id:.*<(.*)\.abul\.org>/)
  76. {
  77. exception {
  78. `test -d $MAILDIR/.abul.$MATCH1`
  79. if( $RETURNCODE == 1 )
  80. `$MAILDIRMAKE $MAILDIR/.abul.$MATCH1`
  81. to $MAILDIR/.abul.$MATCH1
  82. }
  83. }
  84. ### Liste RMLL 2010
  85. if (/^List-Id:.*<(.*)\.listes20(.*)\.rmll\.info>/)
  86. {
  87. exception {
  88. `test -d $MAILDIR/.rmll.$MATCH2.$MATCH1`
  89. if( $RETURNCODE == 1 )
  90. `$MAILDIRMAKE $MAILDIR/.rmll.$MATCH2.$MATCH1`
  91. to $MAILDIR/.rmll.$MATCH2.$MATCH1
  92. }
  93. }
  94. ### Aquitaine libre lists
  95. if (/^List-Id:.*<(.*)\.listes\.aquitaine-libre\.info>/)
  96. {
  97. exception {
  98. `test -d $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  99. if( $RETURNCODE == 1 )
  100. `$MAILDIRMAKE $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  101. to $MAILDIR/.groups.aquitaine-libre_$MATCH1
  102. }
  103. }
  104. ### WeeChat Lists
  105. if (/^List-Id:.*weechat-(.*)\.nongnu\.org/ || /^To:.*weechat-(.*)\.nongnu\.org/)
  106. {
  107. to $MAILDIR/.weechat.$MATCH1
  108. }
  109. ### Sympa Stuff
  110. if (/^From:.*SYMPA/ || /^To:.*sympa-request@.*$/)
  111. {
  112. to $MAILDIR/.logs
  113. }
  114. ### Logs Stuff
  115. if (/^From:.*logcheck@/ || /^Subject:.*rkhunter/ || /^Subject:.*Logwatch for/ || /^From:.*Cron Daemon/ || /^Subject:.*shinji\..* run output/)
  116. {
  117. to $MAILDIR/.logs
  118. }
  119. ### Spam
  120. CRMSCORE=`grep -a -v "^X-CRM114" | crm -u $HOME/.crm/ /usr/share/crm114/mailfilter.crm --stats_only`
  121. xfilter "formail -I \"X-CRM114-Score: $CRMSCORE\""
  122. if ($CRMSCORE < -1)
  123. {
  124. xfilter "formail -I \"X-CRM114-Spam: yes\""
  125. }
  126. #log "Spam: $CRMSCORE"
  127. #if (/^X-CRM114-Spam: yes/)
  128. #{
  129. # to $MAILDIR/.Spam
  130. #}
  131. #xfilter "spamc"
  132. if (/^X-Spam-Status: YES/)
  133. {
  134. to $MAILDIR/.Spam
  135. }
  136. if (!/^From:.*/ || /^Subject:.*\[\*\*SPAM\*\*\].*/)
  137. {
  138. to $MAILDIR/.Spam
  139. }
  140. ########### TRASH ###############
  141. if (/^From:.*(mailandgo\.fr|optingo\.net|refleximmo\.com).*$/)
  142. {
  143. to $MAILDIR/.Trash
  144. }
  145. ########### INBOX ###############
  146. to $MAILDIR/