Search code examples
c#win-universal-appwindows-10-mobile

EmailManager message body getting truncated


I am trying to send an email in an UWP using C# on Windows Phone 10.

I am trying to send an email with text in its body. However, I noticed that it is getting truncated.

I simplified the code to following and can still see the problem:

    Windows.ApplicationModel.Email.EmailMessage email = new Windows.ApplicationModel.Email.EmailMessage();

email.Body = "";

for(int i =0; i <240; i++)
{
    email.Body += i.ToString("D3");
    email.Body += Environment.NewLine;
}

await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(email);

After running the above code the email composer shows up and this is the end of the body text

228

229

2

  1. I can add more text to the end of body in the email composer and the text is sent properly in the email. So this does not seem to be email composer issue.

  2. I look at the email.Body in the debugger and it shows untruncated text with the expected length (till 239 and of length 1200) , but in email composer it shows the truncated text.

I cannot send this content as attachment so I need to figure out how to send this as content.

Does anyone know why the email body is being truncated.


Solution

  • Does anyone know why the email body is being truncated

    As using mailto: protocol(see Effective maximum mailto: body lengths), this API also has the limitation of the maximum number of characters for Body section, this behavior is related to both API and e-mail client

    Here is my testing result:

    mailto: &body section:

    • 2013 characters - Outlook 2016
    • 2013 characters - Win10 App: Mail

    EmailMessage.Body:

    • 2070 characters - Outlook 2016
    • 2070 characters - Win10 App: Mail

    The possible way for your scenario is to send your email information to remote API and send your e-mail instead of doing in UWP app.