mailto Invalid URI: The hostname could not be parsed.

If the Uri is “mailto”, the Uri format must be in the following format.

mailto:myemail@somedomain.com?subject=Application Feedback&body=Hi there, I really liked your app.

I encountered following error

System.UriFormatException: Invalid URI: The hostname could not be parsed.

It was difficult to find the root cause. Finally I found that I used “&subject” (ampersand) for the first parameter instead of “?subject” (question mark). Once I used “?subject”, everything worked as expected.

0 comments

Your email address will not be published. Required fields are marked *