• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading Emails  RSS feed

 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I am trying to read emails in from a stmp server without javamail api's and i so far have only managed to read the e-mail messages but i can't seem to read any attachments that come with it. I am not very sure as to how i should separate the message from the attachment. This is what i have so far



What are the necessary things that i need to do or changes to the above code in order to read the attachments correctly??

Some codings would really be helpfull

Thank You

Yours Sincerely

Richard West
 
S Hussain
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not clear about the code. The code should have a way of readingt multipart mime messages. Generally attachment(s) are in multipart section. Also, attachments may be encoded by say base64, etc.

I guess it is easy to work with java mail api
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,

First, you're not reading from an SMTP server; you're talking to a POP server -- a different protocol! SMTP listens on port 25, and you send mail by giving it to the server.

Second: multipart MIME messages are really quite complex. Why do you want to reinvent the wheel? Why not simply use JavaMail?
 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Sorry about that what i meant to say was reading from a POP3 server. Why i am not using the Java mail is because it is not part of J2SE and some of the people that use my application don't know how to install that java mail extension. They assume that by downloading the entire JRE means that all my program should be up and running.

Richard West
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you can simply distribute JavaMail as part of your application.
 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Ernest, i don't get what you mean that i can distribute it together with my application. Could you explain in detail if it is of no inconvinience to you. One more thing what about the activation jar.

Richard West
 
Van Glass
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to read attachments from an email you need to break out the MIME parts of the message using the message boundary specified in the Content-Type header.

http://www.jscape.com/articles/retrieving_email_using_java.html
 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I am trying to do this in pure Java and am not looking for a
commercial library. If i had wanted to use a library i would have used JavaMail

Richard West
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaMail doesn't have to be copied into the JRE or anything; it's just a couple of JAR files. However you deploy your application, just include JavaMail.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!