Hello, in Visual Studio 2012 has the EmailComposeTask Object, but it does not have HTML formatting, I would like to know how best to send emails via Windows Phone with HTML Formatting.
Hello, in Visual Studio 2012 has the EmailComposeTask Object, but it does not have HTML formatting, I would like to know how best to send emails via Windows Phone with HTML Formatting.
According to this response and the property description EmailComposeTask.Body on MSDN:
The Body property does not support HTML formatting.
There is no way. However you can use this component (paid): link
See a workaround (on the first link): link
Here a screenshot of the component that allows even attachment.
Implementationexample:
//createanewMailMessageobjectMailMessagemailMessage=newMailMessage();//setaLive/HotmailorGmail,oracustomSMTPaccountmailMessage.UserName="*****@hotmail.com ; // ****@gmail.com, ****@yourserver.com, etc.
mailMessage.Password = "********";
mailMessage.AccountType = accountType.MicrosoftAccount; //you can set your CustomSMTP server/port/no-ssl
mailMessage.From = "[email protected]";
//set mail data
mailMessage.To = "[email protected]";
mailMessage.ReplyTo = "[email protected]";
mailMessage.Cc= "[email protected];[email protected];[email protected]";
mailMessage.Bcc= "[email protected];[email protected];[email protected]";
mailMessage.Subject = "Hello from WP";
mailMessage.Body = "I can send any type of attachment from my app now !!"; **//text or HTML**
//attach ANY KIND of file from a resource or IsolatedStorage path
mailMessage.AddAttachment("\resources\file.jpg");
mailMessage.AddAttachment("\docs\file.pdf");
mailMessage.AddAttachment("\docs\file.xls");
mailMessage.AddAttachment("\rex\file.wav");
mailMessage.AddAttachment("\myFolder\file.mp3");
mailMessage.AddAttachment("\downloads\file.mp4");
//attach from in-memory data:
mailMessage.AddAttachment(Encoding.UTF8.GetBytes("yesssss".ToCharArray()), "memoryfile.txt");
//set message event handlers
mailMessage.Error += mailMessage_Error;
mailMessage.MailSent += mailMessage_MailSent;
mailMessage.Progress += mailMessage_Progress;
//send email (async)
mailMessage.SendMail();