Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to encode string subject using the MimeMessage and Transport objec

Status
Not open for further replies.

thelordoftherings

Programmer
May 16, 2004
616
IL
Hello,

I am using the MimeMessage and Transport objects in order to send mails. is there any method/option to encode the subject and the body string messages using these objects before sending?

Roy

 
as UTF-8 for example. I know I can encode the string separately I just need to know if I can do it for the whole object at once...
 
I guess to encode the email content, you need to do it when you call setContent() - eg, encode the actual data you are setting.

Similarly, I guess if you want to encode the subject, you need to create a String that is UTF-8 - and then use that String when you call setSubject().

I cannot see any methods for encoding a MimeMessage or Message object per se ...



--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Hello sedj,

Well, apparentlyt here is such an otpion.
I found out that using:
setContent(body, "text/plain;charset=UTF-8")
do the trick!

Roy
 
Roy,

I thought I had mentioned that when I said :

to encode the email content, you need to do it when you call setContent()

Anyway, sorry if I was not clear enough !


--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top