I am having a problem sending an e-mail through Gmail SMTP server. All portuguese accented characters are replaced by a question mark. Message source code analisys showed that the default charset is not what I expected to be (UTF8) but ANSI_X3.4-1968.
It worked well on a development machine, but didn't on the production environment.
Development machine:
Ubuntu 7.10
System Encoding: UTF8
Default Java Charset:UTF-8
Source code of the message sent by development machine
(...)
MIME-Version: 1.0
Content-Type: text/plain; charset=*UTF-8*
Content-Transfer-Encoding: quoted-printable
(...)
Caro FotoRep=C3=B3rter,
(...)
--- End of message
Production machine
SUSE LINUX 10.0 (i586)
VERSION = 10.0
System Encoding: UTF8
Default Java Charset:UTF-8
Source code of the message sent by production machine
(...)
MIME-Version: 1.0
Content-Type: text/plain; charset=*ANSI_X3.4-1968*
Content-Transfer-Encoding: 7bit
(...)
Caro FotoRep?rter
(...)
--- End of message
The application gets the content from a configuration file:
//(...)
MimeMessage msgtoSend = new MimeMessage(session);
msgtoSend.setText(this.getMessage());
msgtoSend.setSubject(this.getSubject());
//(...)
protected String getSubject() {
subject = ConfigApplicationFacade.getProperties().getProperty("mail.user_notfound.subject");
return subject;
Maybe the problem is there, although the files are exactely the same both on production and development and it worked on development. I wrote a simpler code that gets the content from a string and it works. Any ideas of what could be causing this?
Thanks in advance,
Rodrigo