Fixed mailer so that it works on heroku and localhost.