Fixed email sending bug