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

Commit 27e41c8

Browse files
authored
Merge pull request #1236 from xamarin/develop
1.5.3.1
2 parents d7ba066 + e7dc92a commit 27e41c8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Xamarin.Essentials/Email/Email.android.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,18 @@ static Task PlatformComposeAsync(EmailMessage message)
3434

3535
static Intent CreateIntent(EmailMessage message)
3636
{
37-
var action = message?.Attachments?.Count > 1 ? Intent.ActionSendMultiple : Intent.ActionSend;
37+
var action = (message?.Attachments?.Count ?? 0) switch
38+
{
39+
0 => Intent.ActionSendto,
40+
1 => Intent.ActionSend,
41+
_ => Intent.ActionSendMultiple
42+
};
3843
var intent = new Intent(action);
39-
intent.SetType("message/rfc822");
40-
intent.SetData(Uri.Parse("mailto:")); // only email apps should handle this
44+
45+
if (action == Intent.ActionSendto)
46+
intent.SetData(Uri.Parse("mailto:"));
47+
else
48+
intent.SetType("message/rfc822");
4149

4250
if (!string.IsNullOrEmpty(message?.Body))
4351
{

0 commit comments

Comments
 (0)