As usual you're right Craig,

in case it could help others the right piece of code is:
// attach the file to the message
FileDataSource fds=new FileDataSource(filename);
mbp2.setDataHandler(new DataHandler(fds));
String correctFileName = filename.substring(filename.lastIndexOf("\\") + 1);
mbp2.setFileName(correctFileName );



Le 10:05 21/09/99 -0700, Craig R. McClanahan a �crit:
 > [snip]
 >      MimeBodyPart mbp2 = new MimeBodyPart();
 >              // attach the file to the message
 >      FileDataSource fds=new FileDataSource(filename);
 >      mbp2.setDataHandler(new DataHandler(fds));
 >      mbp2.setFileName(filename);
 > [snip]

Can't you just strip off the directory part of "filename" before you call
setFileName()?  By that point, you've already set up the data source for the
attachment, so JavaMail knows where to find it.  My understanding is that
whatever you set with setFileName() is the proposed filename that the message
receiver sees.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to