Unicode chars and Spring JavaMailSenderImpl, no unicode chars under Linux! -


i'm using spring , javamailsenderimpl, famous spring class send emails. emails contain lot of unicode chars èéàò or notably dreaded € symbol. classes work fine when run on windows. emails sent chars (plain text, no html). if install app on linux virtual server, i'll ? instead of special chars. spring, java configuration or else?

update

basically architecture this: there spring web application , use spring javamailsenderimpl work done. configuration in servlet-context:

<bean id="mailsender" class="org.springframework.mail.javamail.javamailsenderimpl">     <property name="host" value="${email.server}" />     <property name="username" value="${email.server_user}"></property>     <property name="password" value="${email.server_pass}"></property> </bean> 

i'm using same host on windows , linux send mail (that not same machine application runs on... standard mail service provider on smtp).

the code use send email simply:

simplemailmessage msg = new simplemailmessage();             msg.setto(adminemail);             msg.setfrom(adminemail);             msg.setsubject(subject);             msg.settext(message);             mailsender.send(msg); 

even setting:

system.setproperty("mail.mime.charset", "utf8"); 

at application startup doesn't solve situation. in fact, before getting ? instead of €, �...

in case, resolved encoding problem specifying javamailsenderimpl's defaultencoding:

mailsender = new javamailsenderimpl(); ... mailsender.setdefaultencoding("utf-8"); 

i believe can set value in bean configuration:

<bean id="mailsender" class="org.springframework.mail.javamail.javamailsenderimpl">     ...     <property name="defaultencoding" value="utf-8"/> </bean> 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -