0

I want to send emails from my application by using Windows Mail App. MS offers EmailManager for this, which allows sending messages in HTML format but `EmailManager have an issue related to working with HTML API.

After researching for understanding what is the issue, I find these articles

Does the Win 10 UWP EmailMessage API support having an HTML body?

EmailMessage with EmailMessageBodyKind.Html

I began to use the features of the Manager`

        private async void SendByEmail(StorageFile file , string text)
        {
            var emailMessage = new EmailMessage();
            emailMessage.Attachments.Add(new EmailAttachment(file .Name, file ));
            emailMessage.Body = text;
            await EmailManager.ShowComposeNewEmailAsync(emailMessage);
        }

but it does not match my requirements.

Are there other ways in UWP to send emails using Windows Mail App?

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197

1 Answers1

1

UWP has no other mail API, and does not support html preview.

The EmailManager.ShowComposeNewEmailAsync, and EmailManagerForUser.ShowComposeNewEmailAsync methods won't recognize an HTML formatted body. You can only use those methods to send email in plain text.

You can try to send mail with HTML format through .net API in namespace System.Net.Mail.

Junjie Zhu - MSFT
  • 2,086
  • 1
  • 2
  • 6
  • Hello, we know that to use the System.Net.Mail of .net API we must have the credentials(username, password, etc.) of our users but we do not. Is that possible to use .net API without credentials? – Harutyun Dokhoyan Dec 08 '22 at 11:24
  • 1
    Yes, the .net mail api requires user credentials so the API could directly send the email. UWP mail API just help to create the mail body and user need to send the email manually. There is no other mail API in UWP. The UWP API you are using does not support HTML body as the document said. – Junjie Zhu - MSFT Dec 09 '22 at 07:50