Ejemplo n.º 1
0
        public void SendNotification()
        {
            IEnumerable <ContactDTO> contacts = _reader.Read();

            foreach (var contact in contacts)
            {
                _reminder.RegistrationDate = contact.ConvertRegistrationToDate();
                if (_reminder.HasExpiryDateApproaching())
                {
                    if (_repo.IsMailSentToday(contact.Id))
                    {
                        continue;
                    }

                    //_emailService.SendEmail(contact.Email,
                    //"Your IMG registration is expiring " +
                    //_formatter.GetEmailSubject(_reminder), _formatter.GenerateHtml(contact, _reminder));

                    _emailService.SendEmail(contact.Email,
                                            " Membership Reminder from the IMG ", _formatter.GenerateHtml(contact, _reminder));



                    var history = new EmailHistory()
                    {
                        ContactID     = contact.Id,
                        LastEmailSent = DateTime.Today,
                        Name          = contact.Name
                    };
                    history.TotalReminders += 1;
                    _repo.Add(history);
                }
            }
        }
Ejemplo n.º 2
0
        public void ShouldSendEmail()
        {
            GmailSMTPService service = new GmailSMTPService();

            service.SendEmail("*****@*****.**", "test", "<h1>Test</h1>");
        }