{"id":87,"date":"2011-02-09T09:21:00","date_gmt":"2011-02-09T09:21:00","guid":{"rendered":"https:\/\/www.root42.de\/blog\/?p=87"},"modified":"2011-02-09T09:21:00","modified_gmt":"2011-02-09T09:21:00","slug":"conditionally-rewriting-mail-subjects-using-exim4","status":"publish","type":"post","link":"https:\/\/www.root42.de\/blog\/?p=87","title":{"rendered":"Conditionally rewriting mail subjects using exim4"},"content":{"rendered":"<p>Since <a href=\"http:\/\/me.com\/\">MobileMe<\/a> sadly does not support filtering using <a href=\"http:\/\/en.wikipedia.org\/wiki\/RegEx\">RegExps<\/a>, and I get a lot of heterogenous system mails from our computer systems here, I implemented a workaround. I added some text like [System] to the subject, which can be filtered fine by MobileMe.<\/p>\n<p>All of our machines here send their mail to a central smarthost running exim4. All the system mails are directed to &#8220;root&#8221; at some of our machines. What I did was first adding a file \/etc\/exim4\/exim.filter containing this:<\/p>\n<pre># Exim filter<br \/>if \"$h_to:\" matches Nroot@.*.your.domain.deN then<br \/>headers add \"New-Subject: [System] $h_subject:\"<br \/>headers remove subject<br \/>headers add \"Subject: $h_new-subject:\"<br \/>headers remove new-subject<br \/>endif<br \/><\/pre>\n<div><\/div>\n<div>\n<div>Since we are running Debian, running exim4 in split configuration, I also added the file \/etc\/exim4\/conf.d\/main\/80_exim4-config_system_filter, containing this:<\/p>\n<\/div>\n<pre>system_filter = \/etc\/exim4\/exim.filter<\/pre>\n<\/div>\n<p>After that I had to run <span style=\"font-family: 'Courier New', Courier, monospace;\">update-exim4.conf<\/span> and <span style=\"font-family: 'Courier New', Courier, monospace;\">\/etc\/init.d\/exim4<\/span> reload. Then I was all set up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since MobileMe sadly does not support filtering using RegExps, and I get a lot of heterogenous system mails from our computer systems here, I implemented a workaround. I added some text like [System] to the subject, which can be filtered fine by MobileMe. All of our machines here send their mail to a central smarthost &hellip; <a href=\"https:\/\/www.root42.de\/blog\/?p=87\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Conditionally rewriting mail subjects using exim4&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,65,2,64],"tags":[],"_links":{"self":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/87"}],"collection":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87"}],"version-history":[{"count":0,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}