I'm working with windows phone 8 application I need to send HTML contents using Email compose task, Any one can help me?.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
As you can read here, you cannot use html formating using EmailComposeTask. To do that you will need to use a third party library line MailMessage or create a web service to send the mail from the web service.
回答2:
As previously mentioned, you can't send HTML with EmailComposeTask
. But you can do it with SendGridPlus, which I just released yesterday. Using their Web transport protocol, you can send Text & Html emails, with attachments. All you need is a free SendGrid account, which lets you send 200 emails/day.
Open up NuGet Package Manager (make sure you have the latest version of NuGet installed) and type install-package SendGridPlus -pre
. Then, you can use the following code:
var mail = Mail.GetInstance();
mail.From = new MailAddress("someone@stackoverflow.com");
mail.AddTo("you@thispost.com");
mail.Subject = "Emails from Windows Phone!";
mail.Html = "<b>Isn't this cool?!?</b>;
var credentials = new NetworkCredential(sg_UserName, sg_Password);
var sendGrid = Web.GetInstance(credentials);
sendGrid.Deliver(mail);
HTH!