简体   繁体   中英

Newsletter in silverlight, converting xaml to html?

For my project I'm trying to create a page where my admin can send an email through the website itself. I created the following for each to send emails to each of the subscribers.

foreach (Inschrijvingen person in ingeschrevenen)
            {
                mailclient.SendMailAsync(person.naam, "Ondernemersaward Nieuwsbrief", person.email, "ondernemersaward@gmail.com", txtSubject.Text, txtContent.Text);
            }

It is then send to my email service which sends the email.

public Boolean SendMail(string emailFromName, string emailToName, string emailTo, string emailFrom, string msgSubject, string msgBody)
        {
            try
            {
                var fromAddress = new MailAddress(emailFrom, emailFromName);
                var toAddress = new MailAddress(emailTo, emailToName);
                const string fromPassword = "123456789oa";
                string subject = msgSubject;
                string body = msgBody;

                var smtp = new SmtpClient
                {
                    Host = "smtp.gmail.com",
                    Port = 587,
                    EnableSsl = true,
                    DeliveryMethod = SmtpDeliveryMethod.Network,
                    Credentials = new NetworkCredential(fromAddress.Address, fromPassword),
                    Timeout = 20000
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = body
                })
                {
                    smtp.Send(message);
                }
            }

This all works but my problem is that the text that is inserted into the mail is just one line of text. I would like the user to able to "position" the text a bit.

Now I know this is possible with a richtextbox , but that only returns XAML . I'm quite sure I can't send XAML with my email as it would be unreadable.

So I was wondering if it was possible to convert XAML to HTML in some way? Or if there is another, better way to do this?

I found one converter here (in another stackoverflow question ), but I can't seem to get it working as it's made for a very old version of silverlight. I also found the following msdn page , but I can't seem to get it working either. In each of the applications I get about 255 errors.

I am hoping one of you can help me, thank you for taking the time to read this and trying to help me. Thomas

通过阅读您的问题,我认为您真正正在寻找一种像这样的基于银光的html编辑器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM