.mailfilter 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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/ || /^From:.*tpeweb@paybox\.com/)
  18. {
  19. to $MAILDIR/.rmll.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:.*<(.*)\.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. ### SYMPA Lists
  104. if (/^List-Id:.*<sympa-(.*)\.cru\.fr>/)
  105. {
  106. exception {
  107. `test -d $MAILDIR/.sympa.$MATCH1`
  108. if( $RETURNCODE == 1 )
  109. `$MAILDIRMAKE $MAILDIR/.sympa.$MATCH1`
  110. to $MAILDIR/.sympa.$MATCH1
  111. }
  112. }
  113. ### FDN Lists
  114. if (/^List-Id:.*<(.*)\.fdn\.fr>/)
  115. {
  116. exception {
  117. `test -d $MAILDIR/.abul.$MATCH1`
  118. if( $RETURNCODE == 1 )
  119. `$MAILDIRMAKE $MAILDIR/.fdn.$MATCH1`
  120. to $MAILDIR/.fdn.$MATCH1
  121. }
  122. }
  123. ### Aquitaine libre lists
  124. if (/^List-Id:.*<(.*)\.listes\.aquitaine-libre\.info>/)
  125. {
  126. exception {
  127. `test -d $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  128. if( $RETURNCODE == 1 )
  129. `$MAILDIRMAKE $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  130. to $MAILDIR/.groups.aquitaine-libre_$MATCH1
  131. }
  132. }
  133. ### WeeChat Lists
  134. if (/^List-Id:.*weechat-(.*)\.nongnu\.org/ || /^To:.*weechat-(.*)\.nongnu\.org/)
  135. {
  136. to $MAILDIR/.weechat.$MATCH1
  137. }
  138. ### Sympa Stuff
  139. if (/^From:.*SYMPA/ || /^To:.*sympa-request@.*$/)
  140. {
  141. to $MAILDIR/.logs
  142. }
  143. ### Logs Stuff
  144. if (/^From:.*logcheck@/ || /^Subject:.*rkhunter/ || /^Subject:.*Logwatch for/ || /^From:.*Cron Daemon/ || /^Subject:.*shinji\..* run output/)
  145. {
  146. to $MAILDIR/.logs
  147. }
  148. ### AntiSpam
  149. #CRMSCORE=`grep -a -v "^X-CRM114" | crm -u $HOME/.crm/ /usr/share/crm114/mailfilter.crm --stats_only`
  150. #xfilter "formail -I \"X-CRM114-Score: $CRMSCORE\""
  151. #if ($CRMSCORE < -1)
  152. #{
  153. # xfilter "formail -I \"X-CRM114-Spam: yes\""
  154. #}
  155. #log "Spam: $CRMSCORE"
  156. #if (/^X-CRM114-Spam: yes/)
  157. #{
  158. # to $MAILDIR/.Spam
  159. #}
  160. #xfilter "spamc"
  161. if (/^X-Spam-Status: YES/)
  162. {
  163. to $MAILDIR/.Spam
  164. }
  165. if (!/^From:.*/ || /^Subject:.*\[\*\*SPAM\*\*\].*/)
  166. {
  167. to $MAILDIR/.Spam
  168. }
  169. ########### TRASH ###############
  170. if (/^From:.*(mailandgo\.fr|optingo\.net|refleximmo\.com).*$/)
  171. {
  172. to $MAILDIR/.Trash
  173. }
  174. if (/^X-Bounce-Tracking-Info:.*/)
  175. {
  176. to $MAILDIR/.Trash
  177. }
  178. ########### INBOX ###############
  179. to $MAILDIR/