Fixed email sending functionality.