.mailfilter 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. ### Openics lists
  8. if (/^List-Id:.*<(.*)\.lists\.openics\.org>/)
  9. {
  10. exception {
  11. `test -d $MAILDIR/.rmll.$MATCH1`
  12. if( $RETURNCODE == 1 )
  13. `$MAILDIRMAKE $MAILDIR/.openics.$MATCH1`
  14. to $MAILDIR/.openics.$MATCH1
  15. }
  16. }
  17. ### RMLL Lists (2009 and previous)
  18. if (/^X-BeenThere:\s*(.*)@rmll\.info/)
  19. {
  20. exception {
  21. `test -d $MAILDIR/.rmll.09.$MATCH1`
  22. if( $RETURNCODE == 1 )
  23. `$MAILDIRMAKE $MAILDIR/.rmll.09.$MATCH1`
  24. to $MAILDIR/.rmll.09.$MATCH1
  25. }
  26. }
  27. if (/^From:.*reservation@/ || /^From:.*tpeweb@paybox\.com/ || /^From:.*noreply@ogone\.com/)
  28. {
  29. to $MAILDIR/.rmll.resa
  30. }
  31. ### RMLL lists
  32. if (/^List-Id:.*<(.*)\.listes\.rmll\.info>/)
  33. {
  34. exception {
  35. `test -d $MAILDIR/.rmll.$MATCH1`
  36. if( $RETURNCODE == 1 )
  37. `$MAILDIRMAKE $MAILDIR/.rmll.$MATCH1`
  38. to $MAILDIR/.rmll.$MATCH1
  39. }
  40. }
  41. ### RMLL lists - 2010
  42. if (/^List-Id:.*<(.*)\.listes20(.*)\.rmll\.info>/)
  43. {
  44. exception {
  45. `test -d $MAILDIR/.rmll.$MATCH2.$MATCH1`
  46. if( $RETURNCODE == 1 )
  47. `$MAILDIRMAKE $MAILDIR/.rmll.$MATCH2.$MATCH1`
  48. to $MAILDIR/.rmll.$MATCH2.$MATCH1
  49. }
  50. }
  51. if (/^To:.*benevoles@rmll\.info/)
  52. {
  53. to $MAILDIR/.rmll.10
  54. }
  55. ### RMLL 2011
  56. if (/^List-Id:.*org2011.2011.rmll.info/)
  57. {
  58. to $MAILDIR/.rmll.11.org
  59. }
  60. ### Debian Lists
  61. if (/^List-Id:\s*<debian-(.*)\.lists\.debian\.org>/)
  62. {
  63. exception {
  64. `test -d $MAILDIR/.debian.$MATCH1`
  65. if( $RETURNCODE == 1 )
  66. `$MAILDIRMAKE $MAILDIR/.debian.$MATCH1`
  67. to $MAILDIR/.debian.$MATCH1
  68. }
  69. }
  70. if (/^List-Id:.*<backports-users\.lists\.backports\.org>/)
  71. {
  72. to $MAILDIR/.debian.backports
  73. }
  74. ### Debian France Lists
  75. if (/^List-Id:.*<(.*)\.france\.debian\.net>/)
  76. {
  77. to $MAILDIR/.debian-france.$MATCH1
  78. }
  79. ### Debian Alioth Projects
  80. if (/^List-Id:.*<(.*)\.lists\.alioth\.debian\.org>/)
  81. {
  82. exception {
  83. `test -d $MAILDIR/.debian.alioth.$MATCH1`
  84. if( $RETURNCODE == 1 )
  85. `$MAILDIRMAKE $MAILDIR/.debian.alioth.$MATCH1`
  86. to $MAILDIR/.debian.alioth.$MATCH1
  87. }
  88. }
  89. ### Village associatif (Solution Linux)
  90. if (/^List-Id:.*<(.*)\.lists\.parinux\.org>/)
  91. {
  92. to $MAILDIR/.groups.$MATCH1
  93. }
  94. ### FrNog
  95. if (/^List-Id: .*frnog=FRnOG\.org/ || /^List-Id:.*<frnog\.frnog\.org>/)
  96. {
  97. to $MAILDIR/.groups.frnog
  98. }
  99. ### Hurd France Lists
  100. if (/^List-Id:.*<hurdfr\.hurdfr\.org>/)
  101. {
  102. to $MAILDIR/.groups.hurd-fr
  103. }
  104. ### Asyd Lists
  105. if (/^List-Id:.*mailman\.asyd\.net>/)
  106. {
  107. to $MAILDIR/.logs
  108. }
  109. if (/^List-Id:.*<(.*)\.asyd\.net>/)
  110. {
  111. to $MAILDIR/.groups.asyd_$MATCH1
  112. }
  113. ### LabX lists
  114. if (/^List-Id:.*<mailing\.labx\.fr>/)
  115. {
  116. to $MAILDIR/.labx
  117. }
  118. ### ABUL Lists
  119. if (/^List-Id:.*<(.*)\.listes\.abul\.org>/ || /^List-Id:.*<([^\.]*)\.abul\.org>/)
  120. {
  121. exception {
  122. `test -d $MAILDIR/.abul.$MATCH1`
  123. if( $RETURNCODE == 1 )
  124. `$MAILDIRMAKE $MAILDIR/.abul.$MATCH1`
  125. to $MAILDIR/.abul.$MATCH1
  126. }
  127. }
  128. ### Linux-Nantes Lists
  129. if (/^List-Id:.*<(.*)\.linux-nantes\.org>/)
  130. {
  131. exception {
  132. `test -d $MAILDIR/.linux-nantes.$MATCH1`
  133. if( $RETURNCODE == 1 )
  134. `$MAILDIRMAKE $MAILDIR/.linux-nantes.$MATCH1`
  135. to $MAILDIR/.linux-nantes.$MATCH1
  136. }
  137. }
  138. if (/^List-Id:.*<linux-nantes\.univ-nantes.fr>/)
  139. {
  140. to $MAILDIR/.linux-nantes.linux-nantes
  141. }
  142. ### Sud-Ouest.org Lists
  143. if (/^List-Id:.*<(.*)\.listes\.sud-ouest\.org>/)
  144. {
  145. exception {
  146. `test -d $MAILDIR/.sud-ouest.$MATCH1`
  147. if( $RETURNCODE == 1 )
  148. `$MAILDIRMAKE $MAILDIR/.sud-ouest.$MATCH1`
  149. to $MAILDIR/.sud-ouest.$MATCH1
  150. }
  151. }
  152. ### SYMPA Lists
  153. if (/^List-Id:.*<sympa-(.*)\.listes\.renater\.fr>/)
  154. {
  155. exception {
  156. `test -d $MAILDIR/.sympa.$MATCH1`
  157. if( $RETURNCODE == 1 )
  158. `$MAILDIRMAKE $MAILDIR/.sympa.$MATCH1`
  159. to $MAILDIR/.sympa.$MATCH1
  160. }
  161. }
  162. ### Aquilenet Lists
  163. if (/^List-Id:.*<(.*)\.listes\.aquilenet\.fr>/)
  164. {
  165. exception {
  166. `test -d $MAILDIR/.aquilenet.$MATCH1`
  167. if( $RETURNCODE == 1 )
  168. `$MAILDIRMAKE $MAILDIR/.aquilenet.$MATCH1`
  169. to $MAILDIR/.aquilenet.$MATCH1
  170. }
  171. }
  172. ### FDN Lists
  173. if (/^List-Id:.*<(.*)\.fdn\.fr>/)
  174. {
  175. exception {
  176. `test -d $MAILDIR/.fdn.$MATCH1`
  177. if( $RETURNCODE == 1 )
  178. `$MAILDIRMAKE $MAILDIR/.fdn.$MATCH1`
  179. to $MAILDIR/.fdn.$MATCH1
  180. }
  181. }
  182. ### Aquitaine libre lists
  183. if (/^List-Id:.*<(.*)\.listes\.aquitaine-libre\.info>/)
  184. {
  185. exception {
  186. `test -d $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  187. if( $RETURNCODE == 1 )
  188. `$MAILDIRMAKE $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  189. to $MAILDIR/.groups.aquitaine-libre_$MATCH1
  190. }
  191. }
  192. ### WeeChat Lists
  193. if (/^List-Id:.*weechat-(.*)\.nongnu\.org/ || /^To:.*weechat-(.*)\.nongnu\.org/)
  194. {
  195. to $MAILDIR/.weechat.$MATCH1
  196. }
  197. ### KDE projects lists
  198. if (/^List-Id:.*<(.*)\.kde\.org>/)
  199. {
  200. exception {
  201. `test -d $MAILDIR/.kde.$MATCH1`
  202. if( $RETURNCODE == 1 )
  203. `$MAILDIRMAKE $MAILDIR/.kde.$MATCH1`
  204. to $MAILDIR/.kde.$MATCH1
  205. }
  206. }
  207. ### Sympa Stuff
  208. if (/^From:.*SYMPA/ || /^To:.*sympa-request@.*$/)
  209. {
  210. to $MAILDIR/.logs
  211. }
  212. ### Logs Stuff
  213. if (/^From:.*logcheck@/ || /^Subject:.*rkhunter/ || /^Subject:.*Logwatch for/ || /^From:.*Cron Daemon/ || /^Subject:.*shinji\..* run output/)
  214. {
  215. to $MAILDIR/.logs
  216. }
  217. ### AntiSpam
  218. if (/^X-Spam-Status: YES/)
  219. {
  220. to $MAILDIR/.Spam
  221. }
  222. if (!/^From:.*/ || /^Subject:.*\[\*\*SPAM\*\*\].*/)
  223. {
  224. to $MAILDIR/.Spam
  225. }
  226. ########### TRASH ###############
  227. if (/^From:.*(mailandgo\.fr|optingo\.net|refleximmo\.com).*$/)
  228. {
  229. to $MAILDIR/.Trash
  230. }
  231. if (/^X-Bounce-Tracking-Info:.*/)
  232. {
  233. to $MAILDIR/.Trash
  234. }
  235. ########### INBOX ###############
  236. to $MAILDIR/