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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:41:27+00:00 2026-05-15T08:41:27+00:00

I have an application which e-mails confirmations. The email part utilises Commons Mail API.

  • 0

I have an application which e-mails confirmations. The email part utilises Commons Mail API. The simple code which does the send mail is as shown below;

import org.apache.commons.mail.*;
...
// Create the attachment
EmailAttachment attachment = new EmailAttachment();
attachment.setURL(new URL("http://cashew.org/doc.pdf"));
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Testing attach");
attachment.setName("doc.pdf");

// Create the email message
MultiPartEmail email = new MultiPartEmail();
email.setHostName("mail.cashew.com");
email.addTo("ben@cashew.org");
email.setFrom("lot@cashew.org");
email.setSubject("Testing);
email.setMsg("testing message");

// add the attachment
email.attach(attachment);

// send the email
email.send();

My problem is, when I execute this application from Eclipse, I get email sent with attachment without any issues. But when i deploy the application to Tomcat server (I have

tried both version 5 & 6 no joy), the e-mail is sent with below content;

------=_Part_0_25002283.1275298567928
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

testing


Regards,

los

------=_Part_0_25002283.1275298567928
Content-Type: application/pdf; name="doc.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
 filename="doc.pdf"
Content-Description: Testing attach

JVBERi0xLjQNJeLjz9MNCjYzIDAgb2JqDTw8L0xpbmVhcml6ZWQgMS9MIDMxMzE4Mi9PIDY1L0Ug
Mjg2NjY5L04gMS9UIDMxMTgwMi9IIFsgMjgzNiAzNzZdPj4NZW5kb2JqDSAgICAgICAgICAgICAg
DQp4cmVmDQo2MyAxMjcNCjAwMDAwMDAwMTYgMDAwMDAgbg0KMDAwMDAwMzM4MCAwMDAwMCBuDQow
MDAwMDAzNTIzIDAwMDAwIG4NCjAwMDAwMDQzMDcgMDAwMDAgbg0KMDAwMDAwNTEwOSAwMDAwMCBu
DQowMDAwMDA2Mjc5IDAwMDAwIG4NCjAwMDAwMDY0MTAgMDAwMDAgbg0KMDAwMDAwNjU0NiAwMDAw
MCBuDQowMDAwMDA3OTY3IDAwMDAwIG4NCjAwMDAwMDkwMjMgMDAwMDAgbg0KMDAwMDAwOTk0OSAw
MDAwMCBuDQowMDAwMDExMDAwIDAwMDAwIG4NCjAwMDAwMTIwNTkgMDAwMDAgbg0KMDAwMDAxMjky
MCAwMDAwMCBuDQowMDAwMDEyOTU0IDAwMDAwIG4NCjAwMDAwMTI5ODIgMDAwMDAgbg0KMDAwMDAx
.......
CnN0YXJ0eHJlZg0KMTE2DQolJUVPRg0K
------=_Part_0_25002283.1275298567928--

One thing also I have noticed is, the header information donot show TO and Subject values. Hmm pretty wierd.
I have to point out that, above is not generated of DEBUG, it is the actual message recieved in my outlook client.

Can someone help me please!

Update: The application is pretty simple. Attachment a Part and text message as a seperate part also.

   public final void Email(String from, String to, String cc,
          String subject, String message, String doc, String bcc) {

      MultiPartEmail email = new MultiPartEmail();

    try {

        if (!(doc == null)) {
                     EmailAttachment attachment = new EmailAttachment();
                     attachment.setURL(new URL("http://cashew.org/doc.pdf"));
         attachment.setDisposition(EmailAttachment.ATTACHMENT);
         attachment.setDescription("Testing attach");
         attachment.setName("doc.pdf");
                     email.attach(attachment);  
        }


        email.setHostName("mail.cashew.com");

        // [ Set Header details
        email.setTo(getAddress(to));
        email.setFrom(from);
        email.setSubject(subject);


        if (!(cc == null)) {
              eEmail.setCc(getAddress(cc));
        }

        if (!(bcc == null)) {
            email.setBcc(getAddress(bcc));
        }

        email.setMsg(message);

        email.send();


    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

Do anyone knows what’s going on?

  • 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-15T08:41:27+00:00Added an answer on May 15, 2026 at 8:41 am

    This was the issue

    Causes: The described issue is caused by transitive dependencies of
    Apache CXF 2 or Axiom.

    SOLUTION: To resolve this issue, exclude geronimo-javamail_1.4_spec
    from the build, and just rely on javax’s mail-1.4.x.jar.

        <!--For Apache CXF 2 Project: Do this Exclude-->
    <dependency>    
      <groupid>org.apache.cxf</groupid>   
      <artifactid>cxf-rt-frontend-jaxws</artifactid>    
      <version>2.2.6</version>    
        <exclusions>        
          <exclusion>            
           <groupid>org.apache.geronimo.specs</groupid>            
           <artifactid>geronimo-javamail_1.4_spec</artifactid>        
          </exclusion>
         <exclusion> 
          <groupid>org.apache.geronimo.specs</groupid> 
          <artifactid>geronimo-activation_1.1_spec</artifactid>
         </exclusion>    
     </exclusions>
    </dependency>
    
    <!--For Axis2 Project with Axiom Dependency: Do this Exclude-->
    <dependency>  
      <groupid>org.apache.ws.commons.axiom</groupid>  
      <artifactid>axiom-api</artifactid>  
      <version>1.2.8</version>  
        <exclusions>       
         <exclusion> 
          <groupid>org.apache.geronimo.specs</groupid> 
          <artifactid>geronimo-activation_1.1_spec</artifactid>
         </exclusion>
         <exclusion>
          <groupid>org.apache.geronimo.specs</groupid> 
          <artifactid>geronimo-javamail_1.4_spec</artifactid>
         </exclusion>
        </exclusions>
    </dependency>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 451k
  • Answers 451k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Why reinvent the wheel ? The Apache Http Client 4… May 15, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer I replaced element.parent() with element.parents('.classname') in order to pinpoint the… May 15, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer There are a couple of ways of doing this. The… May 15, 2026 at 8:58 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.