modified mail function for heroku