Fix smtp email sending bug