Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending Multiple Emails

 
Crystal Bazil
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically what I am doing with the below code is calling some methods and based on that criteria calling my notfierEmail servlet. NotifierEmail sends off an email notice.

Everything works in theory.. I get an email for the first element in my owner ArrayList with all proper information but then it just stops. No error message or anything.. I need to be able to loop through those owner elements and send off an email for each one.

Could someone point me in a direction on how to do this? I would really appreciate it. Thanks!

Crystal



 
Brendan Caden
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this because your,

ArrayList owners = notifierInformation.getSitemgrList();

is not actually an array? I think it needs [].
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Brendan, an ArrayList is not the same as arrays.

Is this because your,

ArrayList owners = notifierInformation.getSitemgrList();

is not actually an array? I think it needs [].
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Crystal,

I suspect it is the return; thats causing you the problem. Do check it out.



 
Crystal Bazil
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chengwei,

I thought this might be the case as well - However, in Tomcat 5.x it seems I have to put the return in otherwise I get a java.lang.IllegalStateException.

This is information I got here: java.lang.IllegalStateException

I have tried moving the return around to no avail..
[ May 24, 2006: Message edited by: Crystal Bazil ]
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that you are trying to send your e-mails by repeatedly forwarding to a servlet. This won't work because you can only forward the request once. My solution would be to change your design so that you don't use a servlet to send the e-mail, but a plain old Java class that you can use repeatedly.

But I told you all this at least a week ago on the Sun forum.
 
Crystal Bazil
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ETA - I think it just clicked what you meant - Please ignore. I might be back with questions. Thanks

[ May 24, 2006: Message edited by: Crystal Bazil ]


ETA: It is working perfectly now! Thanks All
[ May 24, 2006: Message edited by: Crystal Bazil ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic