简体   繁体   中英

mailto insert a link as the body

I'm trying to insert a link into the body of an email:

string.Format("mailto:email@address.com?subject{0}&body{1}", "Subject Message", "Http://hostname/default.aspx?id={0000000-00000-0000-00000000000)&language=en");

My issue is that the link stops before { and the complete link is not clickable.

I have tried to replace { by %7B and } by %7D but it's not working. Do you have any idea on how to implement that kind of URL ?

Thank you

Try using the following as your body (ie replacing special characters with hex codes - see http://www.ascii-code.com/ for reference)

Http://hostname/default.aspx%3Fid=%7B0000000-00000-0000-00000000000%7D%26language=en

You mentioned you'd tried this with the brackets - but did you also do the ampersand and question mark?

ps. you're also missing the equals signs from your code. Full code should be:

string.Format("mailto:email@address.com?subject={0}&body={1}", "Subject Message", "Http://hostname/default.aspx%3Fid=%7B0000000-00000-0000-00000000000%7D%26language=en");

Sample stand alone HTML:

<html>
    <body>
        <a href="mailto:person@host.com?subject=test&body=http://hostname/default.aspx%3Fid=%7B0000000-00000-0000-00000000000%7D%26language=en">test</a>
    </body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM