Merging mailer from amobrem

First merge from a fork.