.mailfilter 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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@rmll\.info/ || /^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. ### ABUL Lists
  114. if (/^List-Id:.*<(.*)\.listes\.abul\.org>/ || /^List-Id:.*<([^\.]*)\.abul\.org>/)
  115. {
  116. exception {
  117. `test -d $MAILDIR/.abul.$MATCH1`
  118. if( $RETURNCODE == 1 )
  119. `$MAILDIRMAKE $MAILDIR/.abul.$MATCH1`
  120. to $MAILDIR/.abul.$MATCH1
  121. }
  122. }
  123. ### Linux-Nantes Lists
  124. if (/^List-Id:.*<(.*)\.linux-nantes\.org>/)
  125. {
  126. exception {
  127. `test -d $MAILDIR/.linux-nantes.$MATCH1`
  128. if( $RETURNCODE == 1 )
  129. `$MAILDIRMAKE $MAILDIR/.linux-nantes.$MATCH1`
  130. to $MAILDIR/.linux-nantes.$MATCH1
  131. }
  132. }
  133. if (/^List-Id:.*<linux-nantes\.univ-nantes.fr>/)
  134. {
  135. to $MAILDIR/.linux-nantes.linux-nantes
  136. }
  137. ### Sud-Ouest.org Lists
  138. if (/^List-Id:.*<(.*)\.listes\.sud-ouest\.org>/)
  139. {
  140. exception {
  141. `test -d $MAILDIR/.sud-ouest.$MATCH1`
  142. if( $RETURNCODE == 1 )
  143. `$MAILDIRMAKE $MAILDIR/.sud-ouest.$MATCH1`
  144. to $MAILDIR/.sud-ouest.$MATCH1
  145. }
  146. }
  147. ### SYMPA Lists
  148. if (/^List-Id:.*<sympa-(.*)\.listes\.renater\.fr>/)
  149. {
  150. exception {
  151. `test -d $MAILDIR/.sympa.$MATCH1`
  152. if( $RETURNCODE == 1 )
  153. `$MAILDIRMAKE $MAILDIR/.sympa.$MATCH1`
  154. to $MAILDIR/.sympa.$MATCH1
  155. }
  156. }
  157. ### Aquilenet Lists
  158. if (/^List-Id:.*<(.*)\.listes\.aquilenet\.fr>/)
  159. {
  160. exception {
  161. `test -d $MAILDIR/.aquilenet.$MATCH1`
  162. if( $RETURNCODE == 1 )
  163. `$MAILDIRMAKE $MAILDIR/.aquilenet.$MATCH1`
  164. to $MAILDIR/.aquilenet.$MATCH1
  165. }
  166. }
  167. ### FDN Lists
  168. if (/^List-Id:.*<(.*)\.fdn\.fr>/)
  169. {
  170. exception {
  171. `test -d $MAILDIR/.fdn.$MATCH1`
  172. if( $RETURNCODE == 1 )
  173. `$MAILDIRMAKE $MAILDIR/.fdn.$MATCH1`
  174. to $MAILDIR/.fdn.$MATCH1
  175. }
  176. }
  177. ### Aquitaine libre lists
  178. if (/^List-Id:.*<(.*)\.listes\.aquitaine-libre\.info>/)
  179. {
  180. exception {
  181. `test -d $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  182. if( $RETURNCODE == 1 )
  183. `$MAILDIRMAKE $MAILDIR/.groups.aquitaine-libre_$MATCH1`
  184. to $MAILDIR/.groups.aquitaine-libre_$MATCH1
  185. }
  186. }
  187. ### WeeChat Lists
  188. if (/^List-Id:.*weechat-(.*)\.nongnu\.org/ || /^To:.*weechat-(.*)\.nongnu\.org/)
  189. {
  190. to $MAILDIR/.weechat.$MATCH1
  191. }
  192. ### KDE projects lists
  193. if (/^List-Id:.*<(.*)\.kde\.org>/)
  194. {
  195. exception {
  196. `test -d $MAILDIR/.kde.$MATCH1`
  197. if( $RETURNCODE == 1 )
  198. `$MAILDIRMAKE $MAILDIR/.kde.$MATCH1`
  199. to $MAILDIR/.kde.$MATCH1
  200. }
  201. }
  202. ### Sympa Stuff
  203. if (/^From:.*SYMPA/ || /^To:.*sympa-request@.*$/)
  204. {
  205. to $MAILDIR/.logs
  206. }
  207. ### Logs Stuff
  208. if (/^From:.*logcheck@/ || /^Subject:.*rkhunter/ || /^Subject:.*Logwatch for/ || /^From:.*Cron Daemon/ || /^Subject:.*shinji\..* run output/)
  209. {
  210. to $MAILDIR/.logs
  211. }
  212. ### AntiSpam
  213. if (/^X-Spam-Status: YES/)
  214. {
  215. to $MAILDIR/.Spam
  216. }
  217. if (!/^From:.*/ || /^Subject:.*\[\*\*SPAM\*\*\].*/)
  218. {
  219. to $MAILDIR/.Spam
  220. }
  221. ########### TRASH ###############
  222. if (/^From:.*(mailandgo\.fr|optingo\.net|refleximmo\.com).*$/)
  223. {
  224. to $MAILDIR/.Trash
  225. }
  226. if (/^X-Bounce-Tracking-Info:.*/)
  227. {
  228. to $MAILDIR/.Trash
  229. }
  230. ########### INBOX ###############
  231. to $MAILDIR/