• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

email attachment

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i need to has a email function, but how can i store the attachment path
and then retrieve to let user click to download
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check your Private Messages.
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming you are using POP3 or IMAP to access the email from the server...

Both the protocols allow you to access a message and all its attachments easily, is your problem reading the message?

provide some more details ....
 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes. if i store the attachment path
how can i read it and add hyerlink let user download like common email function
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think you can add that as an hyperlink in your application.
mail servers would usually not have a static address for the attachments.

The attachment will be available to your application only when the user has successfully authenticated with the email server and your application has queried for the details of a selected email.

The attachment received will be a part of the Message object.

lets hope this helps you get started, i have left out the attachments part for you...

 
Sheriff
Posts: 22802
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Part.getContent() is your friend when reading anything from an email's contents. Message implements Part.

Run the following recursive call on your Message and see what it returns:
You'll then see for each little part of your email how it is represented. The content could be a String, Multipart, or something else. It's one of those "something else"s you will need.
 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my code is as below:

MultipartRequest multi = new MultipartRequest(httpRequest , "." , 5*1024*1024 , "big5");

String mailserver = "smtpo.hkbn.net";
String From = multi.getParameter("From");
String to = multi.getParameter("To");
String Subject = multi.getParameter("Subject");
String type = multi.getParameter("Type");
String messageText = multi.getParameter("Message");
String FileName = multi.getFilesystemName("FileName");

boolean sessionDebug = false;

try {


java.util.Properties props = System.getProperties();

props.put("mail.host",mailserver);
props.put("mail.transport.protocol","smtp");


....this is part of my code....

do i insert email attachment as string object into the database.
and treat as string object to select attachment to resultset
how to add link to text,after clicking text ,then download and save as the attachement.???
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags when you post source code.
 
Rob Spoor
Sheriff
Posts: 22802
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one important question: what do you want to do exactly? Read an attachment from an existing email, add an attachment to a new email, something else? Because it's not completely clear to me.
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic