Skip to content

[Android] Email.ComposeAsync - problem with empty body and subject on Spark email application #33000

@CleverSoftwarePoland

Description

@CleverSoftwarePoland

Description

When you create email like this

var message = new EmailMessage
{
Subject = "Test Message",
BodyFormat = EmailBodyFormat.PlainText,
Body = "Test Message",
};

await Email.ComposeAsync(message);

It will open up Spark email application but Body and Subject are empty

When you create message like this:

var subject = Uri.EscapeDataString("Test Message");
var body = Uri.EscapeDataString("Test Message");
var uri = new Uri($"mailto:?subject={subject}&body={body}");

await Launcher.OpenAsync(uri);

It will show up correctly

If you add any attachment to EmailMessage it will also work as expected.

I think there is a missing line when creating a message on Email.android.cs

if (action == Intent.ActionSendto)
intent.SetData(Uri.Parse("mailto:"));
else
intent.SetType(FileMimeTypes.EmailMessage);

When using mailto it should also set type

if (action == Intent.ActionSendto)
{
intent.SetData(Uri.Parse("mailto:"));
intent.SetType("text/plain");
}
else
intent.SetType(FileMimeTypes.EmailMessage);

Steps to Reproduce

Crate app and try to send message using Spark App

var message = new EmailMessage
{
Subject = "Test Message",
BodyFormat = EmailBodyFormat.PlainText,
Body = "Test Message",
};

await Email.ComposeAsync(message);

Observe empty message

Link to public reproduction project repository

No response

Version with bug

9.0.110 SR12

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions