Advertisement

01.13.2007 at 12:43PM PST, ID: 22121749
[x]
Attachment Details

JavaMail with MultiPart attachment problem

Asked by henrikatwork in Java Programming Language, JavaMail

Tags: , ,


Hello,

I'm using JavaMail to automatically send an email with a text attachment to a recipient.

The people who were supposed to receive the email has informed me that their system is unable
to read the message. Luckily they were nice enough to send me three SMTP dumps, with two mails
that they could read and one that their system failed to read.

Looking through the dump I've managed to conclude that the successful mails seems to send attachments without using multiparts, a snipped (from a successful mail) looks something like this:

MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7 bit

#BEGIN filename.txt
FROM: XXXXXX xxxx@xxxxxx.xxxx
ATTACHMENT FILE CONTENTS GOES HERE
ATTACHMENT FILE CONTENTS GOES HERE
ATTACHMENT FILE CONTENTS GOES HERE
 
#END

While a snippet from the mail that their system failed to read  looked something like this:

MIME-Version: 1.0
Content-Type: multipart/mixed;
        boundary="b1_24475de5f9dca3c4a2db2e460e99bf1f"

...


--b1_24475de5f9dca3c4a2db2e460e99bf1f
Content-Type: application/octet-stream; name="filename.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="filename.txt"

ATTACHMENT FILE CONTENTS GOES HERE
ATTACHMENT FILE CONTENTS GOES HERE
ATTACHMENT FILE CONTENTS GOES HERE
 
--b1_24475de5f9dca3c4a2db2e460e99bf1f--


I was using a MimeMultipart with my JavaMail to send my message and looking at the dump for those messages they look a lot more like the second (that is, its using multiparts)

Does anybody know how to send attachments without multiparts using JavaMail? Am I just supposed to use those #BEGIN and #END tags manually in my MessageBody string? Or might I have a different problem (multiparts aren't to blame)  ?

//HenrikStart Free Trial
 
Loading Advertisement...
 
[+][-]01.13.2007 at 01:28PM PST, ID: 18309775

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 02:00PM PST, ID: 18309878

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 04:13PM PST, ID: 18310285

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 05:29PM PST, ID: 18310450

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 06:51PM PST, ID: 18310610

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 07:00PM PST, ID: 18310630

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 07:13PM PST, ID: 18310655

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 07:56PM PST, ID: 18310732

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 08:10PM PST, ID: 18310761

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 08:24PM PST, ID: 18310781

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 08:30PM PST, ID: 18310787

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 08:40PM PST, ID: 18310815

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 08:45PM PST, ID: 18310824

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.13.2007 at 09:47PM PST, ID: 18310958

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2007 at 09:52PM PST, ID: 18310969

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2007 at 11:55PM PST, ID: 18314849

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, JavaMail
Tags: javamail, attachment, multipart
Sign Up Now!
Solution Provided By: mrcoffee365
Participating Experts: 4
Solution Grade: A
 
 
[+][-]01.15.2007 at 03:00AM PST, ID: 18315476

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.15.2007 at 03:04AM PST, ID: 18315487

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32