added code for mailgun emailing