Win8/WinRT - How to add line breaks in email body
email, windows-8, windows-runtime, windows-store-apps
Solution
Try using `"%0d%0a"` as your line break, as in
"Hi,%0d%0aCan you please..."
That's a URL-encoded ASCII CR/LF sequence. That works for me for the built-in Mail app but you don't have any particular guarantee that it would work for any arbitrary mail app that the user might install in the future.
Problem
In my Windows 8 Store app, I have a Send Email button on a page and users are able to click it and send us an email for some general enquiries. I need to pre-load some text in the email body but I can't seem to add line breaks to it. I tried `Environment.NewLine` and `"\r\n"`. None of them works. ``` var mailto = new Uri("mailto:?to=james.jones@example.com&subject=Hello world&body=Hi," + Environment.NewLine + "Can you please ..."); await Windows.System.Launcher.LaunchUriAsync(mailto); ``` When I run it, I get "Hi,Can you please...". The line break is omitted.