Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1236 from xamarin/develop
Browse files Browse the repository at this point in the history
1.5.3.1
  • Loading branch information
Redth committed Apr 22, 2020
2 parents d7ba066 + e7dc92a commit 27e41c8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Xamarin.Essentials/Email/Email.android.cs
Expand Up @@ -34,10 +34,18 @@ static Task PlatformComposeAsync(EmailMessage message)

static Intent CreateIntent(EmailMessage message)
{
var action = message?.Attachments?.Count > 1 ? Intent.ActionSendMultiple : Intent.ActionSend;
var action = (message?.Attachments?.Count ?? 0) switch
{
0 => Intent.ActionSendto,
1 => Intent.ActionSend,
_ => Intent.ActionSendMultiple
};
var intent = new Intent(action);
intent.SetType("message/rfc822");
intent.SetData(Uri.Parse("mailto:")); // only email apps should handle this

if (action == Intent.ActionSendto)
intent.SetData(Uri.Parse("mailto:"));
else
intent.SetType("message/rfc822");

if (!string.IsNullOrEmpty(message?.Body))
{
Expand Down

0 comments on commit 27e41c8

Please sign in to comment.