tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: In webapp, sending multipart email with Javamail : noname attachment instead of message
Date Wed, 18 Apr 2012 01:46:59 GMT
Hash: SHA1


On 4/17/12 12:45 PM, Jacques Desodt wrote:
> I try to send a Multipart email in a simple java method, using
> Javamail. When i use the method in a local java app, everything is
> fine. When i use the same method in a webapp hosted by Tomcat, i
> got no message, but a file "noname" in attachment.

Your code looks reasonable. I wonder if you are missing some system
property when running under Tomcat, since you use the system
properties as a basis for your JavaMail session setup.

Try using an empty Properties object instead of taking
System.getProperties() and mutating that. You might find that there is
some property available in your standalone environment that you are
missing in the Tomcat one.

> And here are the results (i use gmail) :
> Images intégrées 1

(I'm not sure what that means... if you attached something to your
email, it was stripped by the mailing list).

> The first (and wrong) email came from the Tomcat server. It has no
> message, and an attachment with "noname" name. The other email is
> good and came from my java app.

What are the differences when you look at the actual source code of
the message? You can learn a lot from looking at the raw MIME message.

BTW, if you intend to move from a simple multipart text message as you
have above to something more complicated (such as text + HTML +
attachments) be aware that the JavaMail API is a complete main in the
neck to use. I would highly recommend using a wrapper API such as
commons-email or my own emailer wrapper you can find at

I happen to like mine better ;)

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message