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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:45:26+00:00 2026-05-27T04:45:26+00:00

I uses following code to send e-mail by hotmail service just like the User

  • 0

I uses following code to send e-mail by hotmail service just like the User Guide

@Override
public Boolean SendMsg(String title, String Content, String receiver, String sender) {
    try {
        HtmlEmail email = new HtmlEmail();
        final String username = s_address;
        final String password = s_pass;
        email.setHostName(s_smtp);
        email.setSmtpPort(Integer.parseInt(s_smtpp));
        email.setAuthentication(username, password);
        email.setSmtpPort(Integer.parseInt(s_smtpp));
        switch (c_smtps) {
            case '1':
                email.setSSL(true);
                email.setSslSmtpPort(s_smtpp);
            case '2':
                email.setTLS(true);
        }
        email.addTo(receiver);
        email.setFrom(s_address, sender);
        email.setSubject(title);
        // set the html message
        email.setHtmlMsg(Content);

        // set the alternative message
        email.setTextMsg(net.shisoft.util.common.html.Session.html2text(Content, true));
        email.send();
        return true;
    } catch (EmailException ex) {
        Logger.getLogger(ClassMail.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}

But I got org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.live.com:587 exception.

The details is

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.live.com:587
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)
    at org.apache.commons.mail.Email.send(Email.java:1267)
    at net.shisoft.rmi.server.svr.plugin.ClassMail.SendMsg(ClassMail.java:232)
    at net.shisoft.sdk.Logic.Mail.Send(Mail.java:108)
    at net.shisoft.communicates.ThreadActions.dealForward(ThreadActions.java:389)
    at net.shisoft.communicates.ThreadActions$1.run(ThreadActions.java:246)
Caused by: javax.mail.MessagingException: IOException while sending message;
  nested exception is:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; 
    boundary="----=_Part_3_499646563.1322072487744"
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:930)
    at javax.mail.Transport.send0(Transport.java:191)
    at javax.mail.Transport.send(Transport.java:120)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
    ... 5 more
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; 
    boundary="----=_Part_3_499646563.1322072487744"
    at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877)
    at javax.activation.DataHandler.writeTo(DataHandler.java:302)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1383)
    at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1743)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:888)
    ... 8 more

After some search,I found someone have the same problem,but not with correct answers(I reied to add follow code

// add handlers for main MIME types
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
CommandMap.setDefaultCommandMap(mc);

But not working).I really don’t know how to fix this

  • 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-27T04:45:26+00:00Added an answer on May 27, 2026 at 4:45 am

    This exception is almost always a due to a problem in the environment in which your
    application runs. Normally, JavaMail will use JAF to find the DataContentHandler
    for each type of data in your message. JAF reads a configuration file in the
    JavaMail mail.jar file. If there’s a problem with your class loaders, JAF might not
    be able to read that configuration file.

    A workaround that sometimes helps is:

    Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
    

    in your main application class.

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

Sidebar

Related Questions

The following code gets a 'report line' as an array and uses fputcsv to
I have the following code which re-uses a CookieContainer which logs in on the
I have the following code to scroll images in vertical direction (uses jCarouselLite )
The following C++ code uses a ifstream object to read integers from a text
The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128.
I'm dealing with a large code base that uses the following construct throughout class
Sql Service Broker uses the following heuristic to determine when you have messages in
I have the following code which uses an array to write the result to
I'm looking at the following example Which uses the following code try { BufferedWriter
I have the following code which I use to send a request to 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.