wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Sending Multiple Emails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sending Multiple Emails" Watch "Sending Multiple Emails" New topic
Author

Sending Multiple Emails

Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
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

Joined: Jan 09, 2006
Posts: 5
Is this because your,

ArrayList owners = notifierInformation.getSitemgrList();

is not actually an array? I think it needs [].
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
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 [].


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Hi Crystal,

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



Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
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
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

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

Joined: Sep 28, 2004
Posts: 38
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending Multiple Emails