开发者_开发问答I'm currently building up an MimeMessage (Java Mail) and sending it to users, but we support multiple locales. At the time of sending we dont know what language the end user can understand.
I was wondering if its possible to attach multiple text/html to the message which are in different languages.
I.e. the first text/html is English, the second text/html is German, the third is French.
Is this possible? If so do I need to add some header to define what locale/lang the html is in?
Thanks Neil
Try adding: Content-language: en Content-language: fr Content-language: de
to your attachments and test with major email clients (Outlook, Yahoo, Gmail, ...)
You may think of two approaches. One is to define a message in English and add other contents as appropriately named attachments (Deutsch.html, Francais.html and so on). You may end up with a problem with support of non-ASCII characters in attachment names. Various MUAs probably won't handle it correctly.
Other approach would be to put the contents in English and add multilingual links like this:
Klicken Sie bitte (...)
Kliknij tu, aby przeczytać tę wiadmość w języku polskim.
The links will point out to a web page with appropriate language version of a message. I am more inclined to second approach as it is more reliable (although it could be a problem if you want to support large number of languages).
精彩评论