microsoft / microsoft/WindowsAppSDK

`EmailManager` is not supported, throws exception

Open
#3,433 13 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature proposal maui-7.x theme-UwpParity
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

Depending on how you look at it I guess this might also be a feature request. In .NET MAUI we have [functionality](https://github.com/dotnet/maui/blob/main/src/Essentials/src/Email/Email.uwp.cs) that allows users to compose an email. For UWP we could use the code underneath to compose an email programmatically and present the user with a screen in their favorite email client to send the email.

```csharp
using Windows.ApplicationModel.Email;
EmailMessage message = new();
// Add to, cc, attachments, body, etc.

await EmailManager.ShowComposeNewEmailAsync(message);
```

When calling this from WinUI, we are presented with an exception "The request is not supported. (0x80070032)"

I've tried exploring alternatives like using `mailto:` or resorting to `MAPI`. The latter might be what this functionality is based on, but that would mean we have to add a lot of code that might already live with you.

### Steps to reproduce the bug

1. Implement code that tries to call `EmailManager`, see above
2. Run the code
3. Observe the exception being thrown

![image](https://user-images.githubusercontent.com/939291/176669934-4aa366f7-522b-444b-b7c6-e4090937c30a.png)

### Expected behavior

The functionality works as it did when running it through UWP which is: present the user with a compose email screen.

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 1.1.1

### Windows app type

- [X] UWP
- [X] Win32

### Device form factor

Desktop

### Windows version

Windows 11 (22H2): Build 22621

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the EmailManager call and the linked .NET MAUI Email.uwp.cs implementation; compare the UWP and WinUI behavior and review the mailto/MAPI alternatives mentioned. Done means WinUI desktop apps can present a compose-email screen without the current 0x80070032 exception, supporting the email fields described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.