Add memory checking and sending email