adding retry logic to email sending