javax.mail.intenet.MimeMessage.setText(txt, charset) won't compile in IntelliJ 4.5

The following snippet compiles OK:
msg.setText(txt)

But I need to set the Character Set. The API docs and IntelliJ's Go To/Implementation confirm the required method:
msg.setText(String s, String s1)

So I try:
msg.setText(txt, charset);

But IntelliJ generates an error, stating that setText(String) in Message cannot be applied. It doesn't seem to recognize that alternative method.

Thanks in advance for any help.

1 comment

Hello Duncan,

I had the same problem not too long ago and resolved it by casting the Message into a MimeMessage. For example:

((MimeMessage)msg).setText("this, that, and the other thing...", "UTF-8");

That said, I don't quit remember how/why I came to this solution but as I recall the root of the problem was not related to IDEA.

Hope this helps,
Peter Boyd

0

Please sign in to leave a comment.