2 Replies Latest reply on Jun 17, 2006 8:11 PM by rgjawanda

    How to receive a mail message and send it right back to the

    rgjawanda

      How can I setup the system to receive an incoming message and then send it right back to the user with a different message.
      I tried creating a Listener and then decided that it might not be the best way.
      I simply want to switch the incoming address to the outgoing address, keep the subject and then modify the body of the message.

      Any ideas would be appreciated.
      I thought of modifying the forwarding listener or the nukes listener. I'm just looking at the code for the first time so am a little confused by what I should do.

      Thanks
      Ron

        • 1. Re: How to receive a mail message and send it right back to
          gohip

          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...

          • 2. Re: How to receive a mail message and send it right back to
            rgjawanda

            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 rjawanda@gmail.gom
            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.

            Funny.

            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.
            Thanks again
            Ron