question

SinghWong-2827 avatar image
0 Votes"
SinghWong-2827 asked Castorix31 commented

Does winui 3 desktop application support "Windows.ApplicationModel.Email"?

Hello everyone,
In uwp, using the following code to achieve the mail function works very well.

                 var emailMessage = new Windows.ApplicationModel.Email.EmailMessage();
                 var email = new ContactEmail()
                 {
                     Address = "user@hotmail.com",
                     Description = "FeedBack",
                 };
                 if (email != null)
                 {
                     var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address);
                     emailMessage.To.Add(emailRecipient);
                     emailMessage.Subject = email.Description;
                     emailMessage.Body = string.Empty;
                 }
    
                 await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage);

But in winui 3 desktop application, an exception will be thrown.
141055-screenshot-2021-10-17-123418.png
Does winui 3 desktop application support "Windows.ApplicationModel.Email"?


windows-app-sdk-winui3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered Castorix31 commented

You can see this thread and the answer from RoyLi-MSFT



· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Thank you for your reply, but I think that using “desktop bridge” is not a better solution in winui 3 desktop application. In Windows Runtime APIs not supported in desktop apps, "Windows.ApplicationModel.Email" is also not mentioned.


0 Votes 0 ·

You can also use MAPISendMail (P/Invoke)
I just tested and it works on my OS (Windows 10 1909)

0 Votes 0 ·