Ejemplo n.º 1
0
 public void Send(string messageType, string to, string mailMessageString)
 {
     using (var mailMessageXmlReader = new XmlTextReader(new StringReader(mailMessageString)))
     {
         mailMessageXmlReader.Read();
         var mailMessage = new SerializableMailMessage();
         mailMessage.ReadXml(mailMessageXmlReader);
         mailerEngine.Send(mailMessage.Email);
     }
 }
Ejemplo n.º 2
0
        public void ScheduleMail(MailMessage email, string jobId, DateTime delay, [CallerMemberName] string memberName = "")
        {
            using (var stringWriter = new StringWriter())
            {
                using (var mailMessageXmlWriter = new XmlTextWriter(stringWriter))
                {
                    var mailMessage = new SerializableMailMessage {
                        Email = email
                    };
                    mailMessage.WriteXml(mailMessageXmlWriter);
                    mailMessageXmlWriter.Flush();

                    var data = stringWriter.ToString();
                    jobManager.Schedule(jobId, () => Send(memberName, email.To.ToString(), data), delay);
                }
            }
        }
Ejemplo n.º 3
0
        public void EnqueueMail(MailMessage email, [CallerMemberName] string memberName = "")
        {
            using (var stringWriter = new StringWriter())
            {
                using (var mailMessageXmlWriter = new XmlTextWriter(stringWriter))
                {
                    var mailMessage = new SerializableMailMessage {
                        Email = email
                    };
                    mailMessage.WriteXml(mailMessageXmlWriter);
                    mailMessageXmlWriter.Flush();

                    var data = stringWriter.ToString();
                    BackgroundJob.Enqueue(() => Send(memberName, email.To.ToString(), data));
                }
            }
        }