-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jacques,

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
http://christopherschultz.net/projects/java/

I happen to like mine better ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+OHRMACgkQ9CaO5/Lv0PDk6wCgtsLID0HPf6nNH2bFc/ThfrTl
J58AnjuTcjIFhj1QOgESVmgMFK5jWOBC
=QXQU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to