Luc Saint-Elie wrote:
> Hello,
>
> Javamail is really an impressive piece of software.. but i've a little
> cosmetic problem
> When I mail files the sent file is named with the full path included.
> I mean that a myfile.doc file that is stored in
> C:\mydocs\mybeautifulldirectory\stuff\foo
> will be received named :
> Cmydocsmybeautifulldirectorystufffoomyfile.doc
> here is my code:
>
> note : the "file" parameter sent by the HTML form contains the whole path
> of my file. If I don't do that JSWDK 1.0 answer that it can't access the file
> [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.
Craig McClanahan
___________________________________________________________________________
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