As it turns out for anyone who is interested, I was using the 1.1-b1 and begrudgingly I have rolled all code back to 1.0.2 and it works the way it is.
Seems the bug is in 1.1-b1 eh? Joe -----Original Message----- From: Joe Latty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 30 April 2002 10:07 AM To: Struts Users Mailing List Subject: Struts and JavaMail I am attempting to send a file (that has been uploaded with the file tag) as an attachment using JavaMail. I am using some very standard code that I have used before many times, the only difference is now I am using Struts and it is not working. Is anyone else successfully sending files as email attachments? Is there some sort of conflict with the Multipart Object (I know I'm clutching at straws, but this is incredibly frustrating). Code excerpt: ... try { MimeMessage message = new MimeMessage(session); // From message.setFrom( new InternetAddress(from)); InternetAddress[] tos = InternetAddress.parse(to); // To message.setRecipients(Message.RecipientType.TO,tos); // Subject message.setSubject(subject); // Date message.setSentDate(new Date()); if (fileName == null) message.setText(bodyText); else { // The body MimeBodyPart body = new MimeBodyPart(); body.setContent(bodyText, "text/html"); // The attachment MimeBodyPart attachment = new MimeBodyPart(); FileDataSource source = new FileDataSource(fileName); attachment.setDataHandler(new DataHandler(source)); attachment.setFileName(source.getName()); // The Multipart to which body and attachment are added Multipart multipart = new MimeMultipart(); multipart.addBodyPart(body); multipart.addBodyPart(attachment); // DEBUG print out of the multipart // This will print out the message body and file contents... multipart.writeTo(System.out); // The MimeMessage has the multipart added message.setContent(multipart); } Transport.send(message); ... TIA Joe -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

