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

Receiving mail

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am doing receive mail using javamail. I can receive date,from and subject(like message[i].getFrom(),message[i].getSubject()). can I receive to,cc,bcc and content. I need urgently,please help me.
Thanks in Advance.
 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jenny soft:
Hi,
I am doing receive mail using javamail. I can receive date,from and subject(like message[i].getFrom(),message[i].getSubject()). can I receive to,cc,bcc and content. I need urgently,please help me.
Thanks in Advance.



Check out javax.mail.Message API's getRecipients method and
javax.mail.Message.RecipientType API
[ December 24, 2007: Message edited by: Balasubramanian Chandrasekaran ]
 
jenny soft
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks a lot for your reply.now I can receive to,from ect... while receiving a single mail.but I got the following error
ERROR.....java.lang.ArrayIndexOutOfBoundsException: 1
while i received multiple mails.
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jenny soft:
Hi,
Thanks a lot for your reply.now I can receive to,from ect... while receiving a single mail.but I got the following error
ERROR.....java.lang.ArrayIndexOutOfBoundsException: 1
while i received multiple mails.



Check your 'message[i]' array capacity.You may be trying to add more values than its actual size.
And still you got error post what javac complains
along with code block
 
jenny soft
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to add more values. even now I got the same error.
ERROR.....java.lang.ArrayIndexOutOfBoundsException: 1
I post my code here



 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code seem to be right.Just post what error(s) you are getting when you compile with javac.(Show us complete error which you get it on terminal(or) command prompt)

Are you getting only this error
java.lang.ArrayIndexOutOfBoundsException: 1

In which statement you are getting this error.Put that error and we may help you.
 
jenny soft
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
during the compile time I had no error, I got the error only at run time and this only one error. that is
ERROR.....java.lang.ArrayIndexOutOfBoundsException: 1
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jenny soft:
during the compile time I had no error, I got the error only at run time and this only one error. that is
ERROR.....java.lang.ArrayIndexOutOfBoundsException: 1



Somewhere you are making a mistake. I recommend you to cross check you arrays first.As it is the only possibility for the exception you got.

You trying to get the value from the array which is not existing.

java.lang.ArrayIndexOutOfBoundsException indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be useful to know in which line of code the exception occurs.
 
jenny soft
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I use like the following method
out.println(i + ": " + message[i].getFrom()[0]+ "\n" + message[i].getSubject() + "\n" + message[i].getContent());
I got the message Continuously.but i want to get every details and store it in one variable.Then pass that variable
to database.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why are you using the i index? From and To are derived from individual messages, therefore they need their own indexing scheme.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic