示例#1
0
        public static bool Process(EmailQueueDto emailQueue)
        {
            var readySubject = ReplaceReplacements(emailQueue.SubjectTemplate, emailQueue.Replacements);
            var readyBody    = ReplaceReplacements(emailQueue.BodyTemplate, emailQueue.Replacements);
            var sendEmailDto = new SendEmailDto(emailQueue.EmailQueueId, emailQueue.From, emailQueue.To, readyBody, readySubject, emailQueue.Host, emailQueue.Port);

            return(EmailHelper.SendEmail(sendEmailDto));
        }
示例#2
0
        public void AddEmailQueue(EmailQueueDto email)
        {
            if (email != null)
            {
                EmailQueue model = new EmailQueue()
                {
                    ToUserID    = email.ToUserID,
                    Subject     = email.Subject,
                    Email       = email.Email,
                    Recipient   = email.Recipient,
                    CC          = email.CC,
                    Bcc         = email.Bcc,
                    IsSent      = email.IsSent,
                    CreatedDate = email.CreatedDate,
                    SentDate    = email.SentDate
                };

                DbContext.EmailQueue.Add(model);
                DbContext.SaveChanges();
            }
        }