tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: In webapp, sending multipart email with Javamail : noname attachment instead of message
Date Wed, 18 Apr 2012 18:22:05 GMT
2012/4/18 Jacques Desodt <jdesodt@gmail.com>:
> Well, a little bit disappointed...
> I changed my code :
>
>    public void sendTestMultipartMail(String host, final String username,
> final String password, String from, String to) throws Exception {
>
>        Properties properties = new Properties();
>        properties.put("mail.smtp.host", host);
>        properties.put("mail.smtp.auth", "true");
>        properties.put("mail.smtp.starttls.enable", "true");
>        properties.put("mail.smtp.port", "587");
>
>        Session session = Session.getInstance(properties,
>          new javax.mail.Authenticator() {
>            protected PasswordAuthentication getPasswordAuthentication() {
>                return new PasswordAuthentication(username, password);
>            }
>          });
>
>        Message msg = new MimeMessage(session);
>
>        msg.setFrom(new InternetAddress(from));
>        msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
>        msg.setSubject("Test MultiPart Mail");
>
>        Multipart multipart = new MimeMultipart();
>
>        BodyPart part1 = new MimeBodyPart();
>        part1.setText("This is multipart mail and u read part1......");
>
>        BodyPart part2 = new MimeBodyPart();
>        part2.setText("This is multipart mail and u read part2......");
>
>        multipart.addBodyPart(part1);
>        multipart.addBodyPart(part2);
>
>        msg.setContent(multipart);
>
>        Transport.send(msg);
>    }
>
> -----------------------------------
> Here is the raw message, sended by my local java app:
>
>(...)
> ... and that's all...
> Why ? I don't understand. Same method, same smtp server.
> Any idea ?

Different libraries?

Try to check, what implementation is returned by those calls,
Session.getInstance(..)

Try running with a debugger,

http://wiki.apache.org/tomcat/FAQ/Developing#Debugging

Best regards,
Konstantin Kolinko

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


Mime
View raw message