• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Batch To Read Mailbox And Fetch The Mail Contents  RSS feed

 
murali jackson
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to design a Java Batch program which will monitor a particular mailbox in MS outlook , and if a new mail is received it should process the mail
and fetch the attachment which is an excel sheet and process the content of the excel sheet and load it to MSSQL database.

I know how to process Excel using java but confused on which design or API I need to use for monitoring mailbox.
Could you please share some high level idea on this... Thanks !!!



 
Tim Moores
Saloon Keeper
Posts: 4024
94
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for handling mail is called JavaMail. I suggest to start with familiarizing yourself with that: how to access mail, how to retrieve new mail, how to determine which messages have attachments etc. Only then add handling of attachments (how that's done has nothing to do with mail processing as such).
 
murali jackson
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim !!!
I will check this API and post here if i have any further doubt...
 
murali jackson
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have googled about Java mail API and used below sample code to connect to my outlook mailbox but it is showing connection failed.
Dont know whether im passing the parameters wrongly. Im sure that my username and password is correct.

Please throw some light on this.



Error is below :



 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a long time since I used JavaMail so I'm a bit rusty but the code looks ok to me.

The exception says it can't connect to the message store due to an invalid address so I'd check the host address you are using.
 
murali jackson
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Now Im able to connect to the host but its throwing certificate chaining error.
When I googled about this error, suggestions was like i need to import certificates to my WAS server.
But this is standalone application which i have not published to any server. So don't know how to proceed.
Please advise.




Error is below

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!