seems like the forwardlistener, would be the way to go...
you could use the JMSMaillistener, or fashion your own, but seems like you'd have to tweak the message before placing on queue, swapping the to, and from, before sticking it on a queue.
If you tweaked the message, early enough in code, the MailListeners methods, would determine that the message is for remote delivery, and would stick it on the remote delivery queue
Andrew's probably got a better idea...
Thanks for the reply.
I tried tweaking the forward listener and I did manage to swap the to and then put my own address in the from however the socket connection hangs all the time trying to connect to the e-mail address domain port 25.
ie: the connection handler tries to connect to the ip address of the incoming e-mail address to send it.
So if the incoming address is email@example.com
I put that in the to (of the Mail msg) and the ConnectionHandler looks like it is trying to send the email using gmails port 25 instead of through mine.
It is quite bizaar. I have been staring at it all day in wonder.
I know it is me but I just don't see why it is trying to use their mail server to send the address instead of mine. And of course... you can't connect to googles port 25 so it hands and hangs.
I think I'm going to give up on that idea. I have been thinking about just querying the db every 5 minutes but it seems like too much of a hack and the listeners are just what I need but I'm green to this code (one day worth of experience). I guess I'm lucky I got this far.
If you have any ideas I'd like to hear.