javax.mail.internet.ParseException when trying to send a MIME message

Hi,

I am using JavaMail to send a MIME message, but I am getting the following exception:

at java.lang.Throwable.fillInStackTrace(Native Method)

at java.lang.Throwable.fillInStackTrace(Compiled Code)

at java.lang.Throwable.<init>(Compiled Code)

at java.lang.Exception.<init>(Compiled Code)

at javax.mail.MessagingException.<init>(MessagingException.java:34)

at javax.mail.internet.ParseException.<init>(ParseException.java:27)

at javax.mail.internet.ParameterList.<init>(Compiled Code)

at javax.mail.internet.ContentType.<init>(ContentType.java:82)

at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1051)

at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1923)

at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1904)

at javax.mail.Transport.send(Transport.java:101)

at FPSend.main(Compiled Code)

The problem seems to be the header of the message, specifically the class-id filed of the content-type. This is the content-type header that causes javaMail to throw that exception:

Content-Type: multipart/alternative;

boundary="110059296832670";

class-id=11:9sc9bnYwM87box:2680047

I think the ":" character in the class-id is causing the problem. Does anybody know if those characters are valid according to MIME standards? And if they are not valid, is there a work around this problem?

thank you!

[1507 byte] By [1351a] at [2007-9-30 23:34:07]
# 1

RFC 2046 doesn't mention the existence of the class-id parameter. But it does say this:Thus, a typical "multipart" Content-Type header field might look like this:

Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08j34c0p

But the following is not valid:

Content-Type: multipart/mixed; boundary=gc0pJq0M:08jU534c0p

(because of the colon) and must instead be represented as

Content-Type: multipart/mixed; boundary="gc0pJq0M:08jU534c0p"From what I see elsewhere, Class-ID is a Microsoft extension. It wouldn't be surprising to find that Microsoft uses extensions that are incompatible with the MIME standards.

DrClapa at 2007-7-7 14:48:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
The message went through when I put " around the malformed class id, like this:class-id="11:9sc9bnYwM87box:2680047"Thanks a bunch.
1351a at 2007-7-7 14:48:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...