mailto link with HTML body

前端 未结 10 1901
攒了一身酷
攒了一身酷 2020-11-21 22:26

I have a couple of mailto links in a HTML document.


Can I insert HTML formatted body in the <

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-21 23:07

    It is worth pointing out that on Safari on the iPhone, at least, inserting basic HTML tags such as , , and (which ideally you shouldn't use in other circumstances anymore anyway, preferring CSS) into the body parameter in the mailto: does appear to work - they are honored within the email client. I haven't done exhaustive testing to see if this is supported by other mobile or desktop browser/email client combos. It's also dubious whether this is really standards-compliant. Might be useful if you are building for that platform, though.

    As other responses have noted, you should also use encodeURIComponent on the entire body before embedding it in the mailto: link.

提交回复
热议问题