/// <summary>
        /// Confirmation email sent to the sender...
        /// </summary>
        /// <param name="toSenderEmail"></param>
        /// <returns></returns>
        public async Task SendGeneralConfirmationEmailAsync(EmailToSendModel toSenderEmail)
        {
            // Sender template (No body)
            var templateText = await ReturnTemplateFromFileAsync("SendMail.Templates.GeneralWebsiteTemplateToSender.html");

            // Confirmation text for sender
            var title    = $"Hey {toSenderEmail.Sender.Name},<br/>Thanks for getting in touch!";
            var subtitle = "I'll try to reply as soon as I can.";

            // New subject title for confirmation email
            toSenderEmail.Email.Subject = "Thanks for getting in touch, " + toSenderEmail.Sender.Name + "!";

            // Replace variables in template with response text and set to Html body
            toSenderEmail.Email.MessageHtml = ReplaceVariablesInTemplate(templateText, title, subtitle, toSenderEmail.Email.DateSent, string.Empty);

            // Set text message in body with confirmation text
            toSenderEmail.Email.MessageText = $"Hey {toSenderEmail.Sender.Name},\n"
                                              + $"Thanks for getting in touch!\n"
                                              + subtitle;

            // Set to true to send Html content
            toSenderEmail.IsHtml = true;

            // Swap the sender and receiver with deep clone
            var tempSender = EmailSenderHelper.DeepCopy(toSenderEmail.Sender);

            toSenderEmail.Sender   = toSenderEmail.Receiver;
            toSenderEmail.Receiver = tempSender;

            // Send confirmation email to Sender
            var response = await _emailSender.SendEmailAsync(toSenderEmail);
        }
        public async Task <EmailSentResponse> SendGeneralEmailAsync(EmailToSendModel email, string title, string subtitle, string body)
        {
            var templateText = await ReturnTemplateFromFileAsync("SendMail.Templates.GeneralWebsiteTemplate.html");

            // Deep clone template and email
            var toReceiverTemplate = string.Copy(templateText);
            var toReceiverEmail    = EmailSenderHelper.DeepCopy(email);

            // Format date to FullDateTime
            var formattedDate = string.Format("{0:F}", email.Email.DateSent);

            // Replace variables in template with email text and set to message Html body
            toReceiverEmail.Email.MessageHtml = ReplaceVariablesInTemplate(toReceiverTemplate, title, subtitle, formattedDate, body);

            // Set to true to send Html content
            toReceiverEmail.IsHtml = true;

            // Send email to Receiver
            var response = await _emailSender.SendEmailAsync(toReceiverEmail);

            // If email was sent successfully...
            if (response.Successful)
            {
                // Make another clone of the original email
                var toSenderEmail = EmailSenderHelper.DeepCopy(email);

                // Send confirmation email to sender
                await SendGeneralConfirmationEmailAsync(toSenderEmail);
            }

            // Return response from email to receiver
            return(response);
        }
        public void SendEmails(IList <Item> items)
        {
            foreach (var item in items)
            {
                var userId     = _itemsRepository.GetUserByItemId(item.Id).Id;
                var user       = _usersRepository.Get(userId);
                var screenshot = _screenshotRepository.GetLastsByItemId(item.Id, 2);

                if (screenshot.Count >= 2)
                {
                    item.Screenshots = screenshot;
                    EmailSenderHelper.SendMessage(user, item);

                    item.UserNotified = true;
                    _itemsRepository.Update(item);
                }
            }
        }
 public NotificacionesCorreoBL()
 {
     _notificacionesCorreoRepositorio = new NotificacionesCorreoRepositorio();
     _emailSenderHelper = new EmailSenderHelper();
 }