Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 974187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:23:44+00:00 2026-05-16T03:23:44+00:00

question is from subject. I’m using JavaMailSenderImpl from spring 3.0.3.RELEASE and velocity 1.6.4 for

  • 0

question is from subject. I’m using JavaMailSenderImpl from spring 3.0.3.RELEASE and velocity 1.6.4 for mail preparation from template.

When I send email with Croatian characters from my webapp recipient receives “?” in stand of normal Croatian characters. If I turn debug mode for mails,
from log I can see that Content-type is set to:

Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

How can I set it to:

Content-Type: text/html; charset=utf-8?

I’m using gmail for mail sending while I’m developing this webapp.

Here are my settings in spring’s servlet xml conf file:

<bean id="userAuthorizationManager" class="com.mypackage.manage.SimpleUserAuthorizationManagerImpl">
    <property name="mailSender" ref="mailSender" />
    <property name="velocityEngine" ref="velocityEngine" />
    <property name="from" value="address" />
    <property name="authorizationAddress" value="some text" />
    <property name="subject" value="some text" />
</bean>

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="host" value="smtp.gmail.com" />
    <property name="port" value="465" />
    <property name="username" value="user" />
    <property name="password" value="pass" />
    <property name="protocol" value="smtps" />

    <property name="javaMailProperties">
        <props>
            <prop key="mail.smtp.auth">true</prop>
            <prop key="mail.smtp.connectiontimeout">5000</prop>
            <prop key="mail.smtp.sendpartial">true</prop>
            <prop key="mail.smtp.userset">true</prop>
            <prop key="mail.mime.charset">UTF-8</prop>
            <prop key="mail.smtp.isSecure">true</prop>
            <prop key="mail.smtp.requiresAuthentication">true</prop>
            <prop key="mail.smtp.auth">true</prop>
            <prop key="mail.smtp.port">465</prop>
            <prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
            <prop key="mail.smtp.socketFactory.fallback">false</prop>
            <prop key="mail.smtp.starttls.enable">true</prop>
            <prop key="mail.debug">true</prop>
        </props>
    </property>
</bean>

<bean id="velocityEngine"
        class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
    <property name="velocityProperties">
        <value>
            resource.loader=class
                class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
        </value>
    </property>
</bean>

Here is my code from mail manager:

private void sendConfirmationEmail(final User user, final int requestId) {
        MimeMessagePreparator preparator = new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
                message.setTo(user.getEmailAddress());
                message.setFrom(from);
                message.setSubject(subject);

                Map<String, Object> model = new HashMap<String, Object>();
                model.put("user", user);
                model.put("authorizationAddress", authorizationAddress);
                model.put("requestId", requestId);
                String text = VelocityEngineUtils
                        .mergeTemplateIntoString(
                                velocityEngine,
                                "com/mypackage/mail/registration-confirmation.vm",
                                model);
                message.setText(text, true);
            }
        };
        PendingMail pendingMail = new PendingMail(preparator);
        pool.submit(pendingMail);

    }
private class PendingMail implements Callable<Object> {
                MimeMessagePreparator preparator;

        protected PendingMail(MimeMessagePreparator preparator) {
            this.preparator = preparator;
        }

        public Object call() {
            mailSender.send(preparator);
            return null;
            }
}

Have you any other suggestion?

Regards,
Tiho

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:23:44+00:00Added an answer on May 16, 2026 at 3:23 am

    I resolved my problem thanks to
    this post.

    According to the post I put this in the mailSender bean configuration:

    <property name="defaultEncoding" value="UTF-8"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's one from the No question's too dumb department: Well, as the subject says:
So I got this question from one of the developers in my team: What
This is a continuation question from a previous question I have asked I now
I'm writing this question from the standpoint of an ASP.NET application. However I realize
I am asking this question from an educational/hacking point of view, (I wouldn't really
I got this question from this discussion . A method call like object.m does
This is an adapted version of a question from someone in my office. She's
As you can see this is a question from a non web developer. I
This is a second-hand question from an OS development site, but it made me
I'm trying to complete a practice question from a book on generics but the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.