Copying outbound emails

I like to have a copy of the emails I compose in my Inbox because it makes threaded message views complete. In the past I’ve used outbound mail filters but this is a bit annoying to maintain when you use several mail clients. A couple weeks ago I finally got around to configuring a server side solution.

The solution I settled on uses MIMEDefang running as a Sendmail milter with a simple rule to add a recipient. I found part of this solution online but I didn’t find a complete example so hopefully this is useful to someone.

Since I don’t need MIMEDefang for anything else I removed all the filter functions from mimedefang-filter and added the following function:

sub filter_end {
        if ($Sender =~ /example\.com>$/ || (grep { /example\.com>$/ } @Recipients)) {
                add_recipient('dan@example.com');
        }
}

Don’t forget to add “1;” to the end of the file if you don’t have any other rules defined (see the sample file).

Leave a comment

Your email address will not be published. Required fields are marked *