使用java邮件API发送电子邮件时出现编码问题
我在我的应用程序中使用 java mail api 发送电子邮件。电子邮件的主题包含连字符(-)。这在 Windows 机器上运行良好。但是,一旦我在 Linux 机器上部署应用程序,电子邮件收件人就会收到带有连字符的电子邮件,电子邮件主题中的连字符会转换为问号。
该问题发生在Cent OS linux环境下。这在 Windows 和 ubuntu Linux 环境下运行良好。
有人可以建议可能是什么问题吗?
谢谢。
I am sending email using java mail api in my application. The subject of email contains hyphen( - ) character. This works fine on windows machine. But once I deploy the application on linux machine, the recipients of email get emails with hyphen getting converted into question mark in the subject of emails.
This problem is occurring in Cent OS linux environment. This is working fine with windows and ubuntu linux environment.
Can somebody please suggest what could be the problem?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定连字符实际上是常规 ASCII 连字符 (0x2D) 吗?如果它看起来像连字符,但实际上是来自不同语言集的 Unicode 字符,您可以轻松地看到跨环境的编码问题。
Are you sure the hyphen character is actually the regular ASCII hyphen (0x2D)? If it's something that looks like a hyphen, but is actually a Unicode character from a different language set, you could easily see encoding problems across environments.