[英]javamail combine html and plain text
I've seen many answerns in StackOverflow of how to send a mail with both, plain text and html text. 我在StackOverflow中看到了很多关于如何发送纯文本和html文本邮件的答案。 My question is, how can I show some kind of link in the html part to see the text part? 我的问题是,如何在html部分显示某种链接以查看文本部分? (something click here to see plain text
and show the plain text version when clicked) ( click here to see plain text
并在单击时显示纯文本版本)
Thanks. 谢谢。
The reason for sending a plain text version is to support clients that can't or won't (security) show HTML. 发送纯文本版本的原因是为了支持不能(或不能)(安全)显示HTML的客户端。 If they have already displayed the HTML version they obviously support it, so a link to plain text is not very useful. 如果他们已经显示了HTML版本,那么他们显然会支持它,因此指向纯文本的链接不是很有用。
What you can easily do is to add the plain text in the HTML and have a link that when clicked hides the formatted version and shows the text in a "plain" version, ie a div that only contains text. 您可以轻松地在HTML中添加纯文本,并具有一个链接,当单击该链接时,该链接将隐藏格式化的版本,并以“普通”版本显示文本,即仅包含文本的div。 That gives you the behavior you are looking for. 这样就可以为您提供所需的行为。
As far as I know there is no way for the HTML rendered in a mail client to access other parts of the mail, at least not in a portable way. 据我所知,邮件客户端中呈现的HTML无法访问邮件的其他部分,至少不能以可移植的方式访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.