error in character encoding when sending an email

asked 2023-04-28 01:27:00 +0800

softteam gravatar image softteam
130 1 8

Hi everyone!!

I have a problem when I send a mail with the javax.mail library and the content of the is an html file. Inside the html file there are spanish symbols and when an email is sent to the recipient,the spanish symbols don't look good.

The funny thing is that if I put <meta charset="UTF-8"> in the html and send the mail from a linux operating system, it displays fine but if I keep this line and run it from a windows operating system it displays badly.

Do you have any idea what might be going on?

my java code:

delete flag offensive retag edit


This is not zk specific problem

hawk ( 2023-05-03 09:37:15 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2023-05-02 11:27:37 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

I'm not sure of the root cause. You might need to set the encoding of your message body part to UTF-8 explicitly. You can do this like:

MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(htmlText, "UTF-8", "html");
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2023-04-28 01:27:00 +0800

Seen: 8 times

Last updated: May 02

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More