Java mail API



Topic:Why can't a recipient using Lotus Notes see the attachment of my mail

created and sent with the JAVA Mail API?

Hi everyone,

I have created Multipart Message to send to different mail users. The

problem is now that the recipient using Lotus Notes can't see the

attachment, whereas Outlook has no problem. Here is my code snippet:



MimeMessage message = new MimeMessage(session);

message.setFrom(new InternetAddress("ulrich@xxxxxxxxxx"));

message.setRecipient(Message.RecipientType.TO,

new InternetAddress("ulrich@xxxxxxxxxxxx"));

Multipart multipart = new MimeMultipart();

//here I create the body content of the mail

String body = "<html><body>That's a test</body></html>";

BodyPart bodyPart = new MimeBodyPart();

bodyPart.setContent(body, "text/html");

multipart.addBodyPart(bodyPart);

//here I create one attachment for the mail

File file = new File("C:/test/ex.pdf");

InputStream is = new FileInputStream(file);

BodyPart attachmentBodyPart = new MimeBodyPart();

DataSource source = new ByteArrayDataSource(is, "application/x-any");

attachmentBodyPart.setDataHandler(new DataHandler(source));

attachmentBodyPart.setFileName("ex.pdf");

multipart.addBodyPart(attachmentBodyPart);

message.setContent(multipart);

javax.mail.Transport.send(message);



I would be very thankful if you could help me.<BR>

Regards, Klaus


.