.mailfilter 3.8 KB

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