Tests for email sending, fix error