• 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

Reading Emails

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
A feeble attempt to tell you about our stuff that makes us money
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic