Refactored a-mailer.js to use a constructor function to create a new
mailer object for better extensibility