如何通过速度模板发送阿拉伯语的电子邮件
我将UTF-8用作字符编码。但仍然确实获得了适当的输出。
message.setSubject(emailSubject,"UTF-16");
message.setSubject(emailSubject,"UTF-8");
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(emailBody, "text/html; charset=UTF-8");
I used UTF-8 as character encoding. but still did get the proper output.
message.setSubject(emailSubject,"UTF-16");
message.setSubject(emailSubject,"UTF-8");
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(emailBody, "text/html; charset=UTF-8");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
什么时候”?有2个选项。
当我诊断出此类问题时,对我有很大帮助的是将信息转换为Unicode序列,而您可以清楚地看到您的信息是否有效或损坏
我有一个由我编写和维护的开源java库mgntutils,它具有将字符串转换为Unicode序列的实用程序,反之亦然:
该代码的输出是:
可以在 github 它以maven fors and succes and succes和javadoc的形式出现
,是班级的javadoc stringunicodeencodencoderdecoder
除非使用它来诊断问题,否则您可以将文本进行诊断,然后将其转换为Unicode序列,然后将其转换为Unicode序列并发送该文本而不是文本。在这种情况下,您没有任何转换,任何系统都应正确显示符号。缺点是信息大小大于原始文本
When you get "?" there are 2 options.
What helped me a lot when I diagnosed such issues was to convert the information into unicode sequences and than you can clearly see if your info is valid or corrupted
There is an Open Source java library MgntUtils written and maintained by me that has a Utility that converts Strings to unicode sequence and vise versa:
The output of this code is:
The library can be found at Maven Central or at Github It comes as maven artifact and with sources and javadoc
Here is javadoc for the class StringUnicodeEncoderDecoder
Except using it to diagnose the issue you can just take your text and convert it to unicode sequences and send that instead of text. in this case you don't have any conversions and the symbols should be displayed correctly by any system. The drawback is that the information size is larger then original text