6 Replies Latest reply on Dec 31, 2003 7:18 AM by acoliver

    remote delivery

       

      "cooper" wrote:
      I have watched the jboss-mail code tonight.

      I think there is a miss for remote delivery. Ok the SMTP protocol can deliver message localy (MaiListener) from outside. But we want also to be able to send message locally to a remote server through a queue.

      This message sending I think is implemented in JES, am I right Eric ? (you say it can act as an open relay on your website). The message sending can be done by merely invoking a method on an MBean. Eventually there is room also for plugin JMS within it as an adapter. Obviously this is local->remote which prevent from begin an open relay. Eventually a MailListener can act as both and do relaying.

      The basic implementation :

      The method sending the message takes the Message object as input with email address destination, put it in a queue for processing. The queue consumer poll the queue, get the MX field from a DNS server to get the remote machine and wire the message over TCPIP.

      Later we can provider better routing for local delivery, in which case they can contact a MailListener to locally deliver the message.

      Eric, Andy what do you think about it, easyly feasible ? already done in JES ?

      julien


        • 1. Re: remote delivery

           

          "cooper" wrote:
          I have watched the jboss-mail code tonight.

          I think there is a miss for remote delivery. Ok the SMTP protocol can deliver message localy (MaiListener) from outside. But we want also to be able to send message locally to a remote server through a queue.

          This message sending I think is implemented in JES, am I right Eric ? (you say it can act as an open relay on your website). The message sending can be done by merely invoking a method on an MBean. Eventually there is room also for plugin JMS within it as an adapter. Obviously this is local->remote which prevent from begin an open relay. Eventually a MailListener can act as both and do relaying.

          The basic implementation :

          The method sending the message takes the Message object as input with email address destination, put it in a queue for processing. The queue consumer poll the queue, get the MX field from a DNS server to get the remote machine and wire the message over TCPIP.

          Later we can provider better routing for local delivery, in which case they can contact a MailListener to locally deliver the message.

          Eric, Andy what do you think about it, easyly feasible ? already done in JES ?

          julien


          • 2. Re: remote delivery

             

            "cooper" wrote:
            I see how it is done in James too this is a mailet, I am going to write a simple RemoteDeliveryService.

            julien


            • 3. Re: remote delivery

               

              "cooper" wrote:
              yooo,

              I did a first basic implementation of a RemoteDeliveryService, very simple. Likewise JES and James, I have to use the dns server library (don't remember the name).

              It will suffice to my needs for nukes to send emails, I just have a send(from, to, subject, body) method that put a job in a queue executor. The executor takes the job, use the DNS to get the MX field and then use javamail to send the message to the recipient.

              Then I will use andy's SMTP server to get the message replies to the forum so user are able to post by replying the email they get from nukes.

              Do you need that in JBoss-mail ? I will commit my bb forum next week I think, so if it is a need (and I hope it is) I can commit there. Instead of having the send method taking string arguments , it can take the Message objects defined in JBossMail.

              cheers,

              Julien


              • 4. Re: remote delivery
                edaugherty

                 

                "edaugherty" wrote:
                As far as I know, yes we will need code to deliver remote emails.

                One thing to think about (I have not looked at your code) is that emails are often to several people, and the actual delivery may span calls to multiple remote smtp servers. To be optimal, addresses should be 'sorted' by smtp server and delivered in one call. If the email is to 10 @yahoo.com addresses, they should all be delivered at once to the yahoo.com SMTP server.

                Like I said, I didn't look at your code yet so hopefully you've thought about it and already improved on my JES implementation. :)

                Eric


                • 5. Re: remote delivery

                   

                  "cooper" wrote:
                  > As far as I know, yes we will need code to deliver
                  > remote emails.
                  >
                  > One thing to think about (I have not looked at your
                  > code) is that emails are often to several people, and
                  > the actual delivery may span calls to multiple remote
                  > smtp servers. To be optimal, addresses should be
                  > 'sorted' by smtp server and delivered in one call.
                  > If the email is to 10 @yahoo.com addresses, they
                  > should all be delivered at once to the yahoo.com
                  > SMTP server.
                  >

                  ok, this is needed to be done by the code that will route the mails, using the SMTPServer and the RemoteDeliveryService.

                  > Like I said, I didn't look at your code yet so
                  > hopefully you've thought about it and already
                  > improved on my JES implementation. :)

                  that's fairly easy and short :

                  MXRecord[] records = _mxLookup("yahoo.com");
                  Properties props = new Properties();
                  props.put("mail.debug", "true");
                  Session session = Session.getDefaultInstance(props);
                  URLName urlname = new URLName("smtp://" + host);
                  Transport transport = session.getTransport(urlname);
                  transport.connect();
                  MimeMessage message = new MimeMessage(session);
                  message.setFrom(new InternetAddress(from));
                  message.setSubject(subject);
                  message.setText(body);
                  transport.sendMessage(message, new InternetAddress[]{new InternetAddress(to)});

                  all the javamail code replace what you did in JES by coding the sending protocol.

                  >
                  > Eric

                  as you said somewhere, there must be a clean error handling, the code I have done is very dumb on that point (but works). Because more than one server can be returned by the MX lookup, there is a need to try all the servers until it is delivered.


                  • 6. Re: remote delivery
                    acoliver

                     

                    "acoliver" wrote:
                    Hey Julien,

                    I'm about to code this but if you have it, I dunnwanna. Is this something you've done already?

                    -Andy