Ejemplo n.º 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);
        }
Ejemplo n.º 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 }));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public void SendEmailFromTemplate(string templateName, EmailEnvelope envelope, AsyncCallback <MessageStatus> responder)
 {
     SendEmailFromTemplate(templateName, envelope, null, responder);
 }
Ejemplo n.º 5
0
 public MessageStatus SendEmailFromTemplate(string templateName, EmailEnvelope envelope)
 {
     return(SendEmailFromTemplate(templateName, envelope, new Dictionary <string, string>()));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 7
0
 public async Task <MessageStatus> SendEmailFromTemplateAsync(string templateName, EmailEnvelope envelope)
 {
     return(await SendEmailFromTemplateAsync(templateName, envelope, null));
 }