Beispiel #1
0
        public void SendEmailFromTemplate(string templateName, EmailEnvelope envelope, Dictionary <string, string> templateValues, AsyncCallback <MessageStatus> responder)
        {
            if (string.IsNullOrEmpty(templateName))
            {
                throw new ArgumentNullException(ExceptionMessage.NULL_EMPTY_TEMPLATE_NAME);
            }

            Invoker.InvokeAsync(EMAIL_TEMPLATE_SENDER_SERVER_ALIAS, "sendEmails",
                                new Object[] { templateName, envelope, templateValues }, responder);
        }
Beispiel #2
0
        public MessageStatus SendEmailFromTemplate(string templateName, EmailEnvelope envelope, Dictionary <string, string> templateValues)
        {
            if (string.IsNullOrEmpty(templateName))
            {
                throw new ArgumentNullException(ExceptionMessage.NULL_EMPTY_TEMPLATE_NAME);
            }

            return(Invoker.InvokeSync <MessageStatus>(EMAIL_TEMPLATE_SENDER_SERVER_ALIAS, "sendEmails",
                                                      new Object[] { templateName, envelope, templateValues }));
        }
Beispiel #3
0
        private async Task <bool> ReadHeader(IEmailClient client, List <string> emailUIDs, List <EmailModel> emailList)
        {
            foreach (var Id in emailUIDs)
            {
                var header = await client.GetHeaderByUID(Id);

                var headerModel = new EmailEnvelope()
                {
                    Id      = Id,
                    Date    = header.Date.Value,
                    Subject = header.Subject,
                    From    = header.From
                };

                _emailListLock.EnterReadLock();
                EmailModel emailModel = emailList.FirstOrDefault(x => x.Id == Id);
                _emailListLock.ExitReadLock();

                if (emailModel != null)
                {
                    emailModel.Header = headerModel;
                }
                else
                {
                    emailModel        = new EmailModel();
                    emailModel.Id     = Id;
                    emailModel.Header = header;

                    _emailListLock.EnterWriteLock();
                    emailList.Add(emailModel);
                    _emailListLock.ExitWriteLock();
                }
            }

            return(true);
        }
Beispiel #4
0
 public void SendEmailFromTemplate(string templateName, EmailEnvelope envelope, AsyncCallback <MessageStatus> responder)
 {
     SendEmailFromTemplate(templateName, envelope, null, responder);
 }
Beispiel #5
0
 public MessageStatus SendEmailFromTemplate(string templateName, EmailEnvelope envelope)
 {
     return(SendEmailFromTemplate(templateName, envelope, new Dictionary <string, string>()));
 }
Beispiel #6
0
 public async Task <MessageStatus> SendEmailFromTemplateAsync(string templateName, EmailEnvelope envelope, Dictionary <string, string> templateValues)
 {
     return(await Task.Run(() => SendEmailFromTemplate( templateName, envelope, templateValues )).ConfigureAwait(false));
 }
Beispiel #7
0
 public async Task <MessageStatus> SendEmailFromTemplateAsync(string templateName, EmailEnvelope envelope)
 {
     return(await SendEmailFromTemplateAsync(templateName, envelope, null));
 }