Fixed bugs in email sending process for movement detection