• Post Reply Bookmark Topic Watch Topic
  • New Topic

Intermittenly observing - replaced by ? in email subjects  RSS feed

 
shashank Kulshreshtha
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am intermittently observing - replaced by ? in email subjects.

Can anyone provide pointers on this?
By any change does it related to server restart or non closed interfaces.

Below is the code i was using
msg.setSubject(subject.trim());

Multipart mp = new MimeMultipart();
BodyPart bp2 = new MimeBodyPart();
bp2.setContent(bodyText, "text/HTML");
mp.addBodyPart(bp2);

msg.setText(bodyText);
msg.setContent(mp);
Transport.send(msg);
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the javadoc of MimeMessage:
Set the "Subject" header field. If the subject contains non US-ASCII characters, it will be encoded using the platform's default charset. If the subject contains only US-ASCII characters, no encoding is done and it is used as-is.

Your subject line probably contains characters that your default charset can't handle. Try using the setSubject method that takes two strings, and provide a better charset (such as UTF-8) as the second argument.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!