• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java mail attachments

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using java mail package to send attachments in my email. I have few questions regarding this.
1) When i do attach the file on to my email, it works fine on my windows machine. It doesn't work on unix machine, it throws FileNotFoundException, saying c:\test.doc not found.
Do i have to store this file temporarily on the server or how does this email attachment work on unix system.
2) Also, is there any limit on the size of the attachment file?
3) Also, if i attach multiple files, does the size limit to combined attached files or individual attached files?
Appreciate your input,
Thanks.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I imagine that this will get moved to a more appropriate forum before long, but to answre your first question:
c:\test.doc is not a valid unix file path.
bear
 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U should write as what ever operating system like this .where Mail_Home
java.lang.String Mail_Home=(String)session.getValue("Mail_Home");
U write one prop file like this
Mail_Home=c:/Imail.

then u can apply this one
******
java.io.File f=new java.io.File(Mail_Home+"/userdir");
****************
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. I agree with having emial_home property. Does that mean the attached file must exist on the server side to solve this path issue.
Our server is running on sun solaris m/c and client(browser) on PC. When i attach a file in my email, do i need to store this attached file temporarily on the server to send the email?
Thanks.
Please let me know,
Appreciate your help.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Mandy,
i dont get u. which server r u talking about? Email Server to which ur JavaMail program sends emails to be sent out?
where is your Java Mail program? I guess its on the client side (downloaded thru applet or u know something like that)...if its not on the client side then how u r invoking it?
sorry but i am kinda lost about what exactly u r having and how u r accessing??? can u please clarify more on this?
thanks
maulin.
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Sorry for the confusion. What i meant by server was my WebServer. I am not talking about the email server here. I have Weblogic server running on sun m/c, which is running my email program and a servlet(servlet invokes my email program). From the browser when i invoke this servlet, it will generate a form to specify subject, body part, from address, to address & file attachment capability.
When i attach my local file(file that exists on my PC) to this form and when i click on Send Email button, it throws a FileNotFoundException.
So, my question is should i store this attached file temporarily on my weblogic server until the email is sent? After sending i can delete this file.
Any further help on this would be greatly appreciated.
Thanks.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mandy, remember that your servlet and/or JSP is running on the web server and then sending the generated response to the client browser via the HTTP connection created for the response. It certainly does not have access to the filesystem of the client (imagine the security ramifications of that were that possible).
If you want your server to have access to the file, you will either need to store it on the server, or somehow make the filesystem of the system where you will be storing the file available via a mechanism other than HTTP.
hth,
bear
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear Bibeault!
So, i am planning to temporarily store the file under tmp directory on the server(webserver) until the email attachment is sent. After the email attachment has been sent, i will delete this file from tmp directory from my webserver.
Thank you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic