.mailfilter 4.7 KB

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