示例代码片段
MimeBodyPart htmlpart = new MimeBodyPart();
htmlpart.setContent("<h1>Sample</h1><p>This is a sample HTML part","text/html");
MimeBodyPart scriptcontent = new MimeBodyPart();
// scriptcontent.setHeader("Content-Type", "application/ld+json");
scriptcontent.setContent(" <script type=\"application/ld+json\">{ \"@context\":\"http://schema.org\",\"@type\":\"EmailMessage\",\"description\":\"Check this out\",\"action\": { \"@type\": \"ViewAction\",\"url\":\"https://www.youtube.com/\" } } </script>","application/ld+json");
Multipart mp = new MimeMultipart();
mp.addBodyPart(htmlpart);
mp.addBodyPart(scriptcontent);
mail.setContent(mp);
我已将脚本类型设置为 json+ld ,但我仍然收到一封没有查看操作的普通电子邮件。