.mailfilter 5.2 KB

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