Esempio n. 1
0
        public async Task SendMailAsync(int id)
        {
            var mails = await _mailRepository.GetPendingMailsByUserIdAsync(id);

            foreach (var mail in mails)
            {
                try
                {
                    _sMTPService.SendMail(mail);
                    mail.Status = Status.Sent;
                }
                catch (Exception)
                {
                    mail.NumberOfTries++;
                    /// SMTP seding failed
                }
            }
            await _mailRepository.SaveAsync();
        }