Adds most of the necessary mailing functionality.