public void WriteXml(XmlWriter writer)
        {
            XmlDocument xmlTemplate = XmlLoader.GetXmlTemplate(base.GetType(), 0);
            XmlNode     xml         = xmlTemplate.SelectSingleNode("MailMessage");

            XmlLoader.SetNode(ref xml, "Body", base.Body);
            XmlLoader.SetNode(ref xml, "Subject", base.Subject);
            XmlLoader.SetNode <MailAddressXml>(ref xml, "Bcc", "MailAddress", MailAddressXml.CopyCollection(base.Bcc));
            XmlLoader.SetNode <MailAddressXml>(ref xml, "Cc", "MailAddress", MailAddressXml.CopyCollection(base.CC));
            XmlLoader.SetNode <MailAddressXml>(ref xml, "To", "MailAddress", MailAddressXml.CopyCollection(base.To));
            XmlLoader.SetNode(ref xml, "From/MailAddress", (IXmlSerializable) new MailAddressXml(base.From));
            XmlLoader.SetNode(ref xml, "Sender/MailAddress", (IXmlSerializable) new MailAddressXml(base.Sender));
            XmlLoader.SetNode(ref xml, "ReplyTo/MailAddress", (IXmlSerializable) new MailAddressXml(base.ReplyTo));
            XmlLoader.SetNode(ref xml, "Priority", base.Priority);
            XmlLoader.SetNode(ref xml, "IsBodyHtml", base.IsBodyHtml);
            XmlLoader.SetNode(ref xml, "Headers", base.Headers);
            XmlLoader.SetNode(ref xml, "DeliveryNotificationOptions", base.DeliveryNotificationOptions);
            if (base.BodyEncoding != null)
            {
                XmlLoader.SetNode(ref xml, "BodyEncoding", base.BodyEncoding.CodePage);
            }
            if (base.SubjectEncoding != null)
            {
                XmlLoader.SetNode(ref xml, "SubjectEncoding", base.SubjectEncoding.CodePage);
            }
            SetNode(ref xml, "Attachments", base.Attachments);
            XmlLoader.WriteInnerXml(xmlTemplate, writer);
        }
예제 #2
0
 public void WriteXml(XmlWriter writer)
 {
     if (this.mailAddress != null)
     {
         XmlDocument xmlTemplate = XmlLoader.GetXmlTemplate(base.GetType(), 0);
         XmlNode     xml         = xmlTemplate.SelectSingleNode("MailAddress");
         XmlLoader.SetNode(ref xml, "Address", this.mailAddress.Address);
         if (!TypeHelper.IsNullOrEmpty(this.mailAddress.DisplayName))
         {
             XmlLoader.SetNode(ref xml, "Name", this.mailAddress.DisplayName);
         }
         XmlLoader.WriteInnerXml(xmlTemplate, writer);
     }
 }