This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

javamail and top -n x of pop protocol  RSS feed

 
canteau cyril
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

I am looking to make a report of the command top -n x pop protocol.
I use javamail and I would have made exactly the same as the telnet command but if possible with javamail

exemple for top in telnet
TOP 1 10
+OK Top of message follows
--- all message headers ---
--- first 10 lines of body ---

with javamail???
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know JavaMail at all, but I know how you can get the output and errors from a command line.  It's a pretty "ugly" process and a lot can go wrong, but here is the basic code.  You can adapt it to your purposes.
 
canteau cyril
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello and thank you for the answer, but I try to have the same behavior as a top -n x in javamail.
I need a rendering via raw javamail
this command: retrieveMessageTop (int messageId, int numLines)
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am not sure what the telnet command does, but if you wish to retrieve a specific number of mails, then check out this method
https://javamail.java.net/nonav/docs/api/javax/mail/Folder.html#getMessages-int-int-


From the API docs
Get the Message objects for message numbers ranging from start through end, both start and end inclusive. Note that message numbers start at 1, not 0.


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!