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 4549274
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:20:15+00:00 2026-05-21T16:20:15+00:00

i have a mailer class that works fine with IE when i run the

  • 0

i have a mailer class that works fine with IE when i run the application locally, but after deploying it on a server it keeps sending gobbledygook and unreadable characters, i dont see where the problem is, everything is utf8, here is my code :

    public static void sendHTMLEmail(String to, String subject, String body)
        throws EmailException {

    HtmlEmail email = new HtmlEmail();
    email.setSmtpPort(25);
    email.setAuthenticator(new DefaultAuthenticator("myMail","myPass"));
    email.setDebug(false);
    email.setHostName("smtp.gmail.com");


    email.setFrom("webmail@mysite.com","Webmail@mysite");
    email.setCharset("UTF-8");
    email.setSubject(subject);

    // --set Body-- 
    String HTMLBody ="<html xmlns='http://www.w3.org/1999/xhtml'>";
    HTMLBody += "<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head>";
    HTMLBody += "<body><div dir='rtl'>";
    HTMLBody += body;
    HTMLBody += "</div></body></html>";
    // -----------

    email.setHtmlMsg(HTMLBody);
    email.setTextMsg("Your email client does not support HTML messages");

    email.addTo(to);
    email.setTLS(true);
    email.send();

}

and here are my libraries :

import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import org.apache.commons.mail.SimpleEmail;

thnx for your time

  • 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-21T16:20:15+00:00Added an answer on May 21, 2026 at 4:20 pm

    I’ll assume that the String body method argument is actually the user-supplied data which has been entered in some <input> or <textarea> and submitted by a <form method="post"> in a JSP page.

    The data will be submitted using the charset as is been specified in the Content-Type header of the page containing the form. If the charset is absent in the Content-Type header, then the browser will simply make a best guess and MSIE is generally not that smart as others, it’ll just grab the client platform default encoding.

    You need to ensure of the following three things to get it all straight:

    • Ensure that the HTTP response containing the <form> is been sent with charset=UTF-8 in the Content-Type header. You can achieve this by adding the following line to the top of the JSP responsible for generating the response:

      <%@page pageEncoding="UTF-8" %>
      

      This not only sets the response encoding to UTF-8, but also implicitly sets the Content-Type header to text/html;charset=UTF-8.

    • Ensure that the servlet which processes the form submit processes the input data in the obtained HTTP request with the same character encoding. You can achieve this by adding the following line before you get any information from the request, such as getParameter().

      request.setCharacterEncoding("UTF-8");
      

      A more convenient way would be to drop that line in some Filter which is been mapped on an URL pattern of interest, so that you don’t need to copypaste the line over all servlets.

    • Ensure that you do not use the accept-charset attribute of the <form>. MSIE has serious bugs with this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have send an email using php mailer class. mail was sending successfully but
I got an class that extends Mailer and would like to have automatic tests
I once heard it's good to have one class with all your application constants
I have mailer: class AdminMailer < ActionMailer::Base default :from => pejottest@gmail.com def message mail(:to
I have this code: class Mailer < ActionMailer::Base def foo recipients bar@example.com from foo@example.com
I've got a mailer that as follows: class Payments::LateNoticesMailer < AsyncMailer def notice(payment_id) @payment
Well this is weird let me describe the scenario I have this mailer define
i have downloaded Swift Mailer from their website and try to send simple email
I am using Swift Mailer to check for bounced messages. I have created one
have written this little class, which generates a UUID every time an object of

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.