Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-367

Added option to CommandListServ to change the to address.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Abandoned
    • None
    • None
    • None
    • N/A

    Description

      I have added the option: <changetoaddress>newaddress@blah</changetoaddress> to the CommandListServProcessor. When an email is sent to the list, it changes the to address into this. Is useful in hiding the list address, or in any other circmstances where you need to make it appear different. Note: it doesnt change the received headers, so the address is still there if people look.

      Daniel.

      — src\java\org\apache\james\transport\mailets\CommandListservProcessor_orig.java Thu Apr 07 17:08:23 2005
      +++ src\java\org\apache\james\transport\mailets\CommandListservProcessor.java Thu Apr 07 16:47:05 2005
      @@ -27,10 +27,11 @@
      import org.apache.mailet.GenericMailet;
      import org.apache.mailet.Mail;
      import org.apache.mailet.MailAddress;
      import org.apache.mailet.MailetException;

      +import javax.mail.Message;
      import javax.mail.MessagingException;
      import javax.mail.internet.MimeMessage;
      import javax.mail.internet.MimeMultipart;
      import javax.mail.internet.ParseException;
      import java.io.IOException;
      @@ -154,11 +155,13 @@
      */
      protected XMLResources xmlResources;

      protected boolean specificPostersOnly;
      protected Collection allowedPosters;
      -
      + protected boolean addFooter;
      + protected String changeToAddress;
      +
      /**

      • Initialize the mailet
        */
        public void init() throws MessagingException {
        try {
        @@ -170,10 +173,12 @@
        subjectPrefix = getString("subjectprefix", null);
        listName = getString("listName", null);
        autoBracket = getBoolean("autobracket", true);
        listOwner = new MailAddress(getString("listOwner", null));
        specificPostersOnly = getBoolean("specifiedpostersonly", false);
        + addFooter = getBoolean("addfooter", true);
        + changeToAddress = getString("changetoaddress", null);
        //initialize resources
        initializeResources();
        //init user repos
        initUsersRepository();
        initAllowedPosters(configuration);
        @@ -206,17 +211,25 @@
        if (!checkBeenThere(listservAddr, mail)) { return; }

      //addfooter

      • addFooter(mail);
        -
        + if (addFooter) { + addFooter(mail); + }

        +
        //prepare the new message
        MimeMessage message = prepareListMessage(mail, listservAddr);
        +
        +

      //Set the subject if set
      setSubject(message);
      +
      + if (changeToAddress!=null)

      { + message.setRecipients(Message.RecipientType.TO, changeToAddress); + }

      //Send the message to the list members
      //We set the list owner as the sender for now so bounces go to him/her
      getMailetContext().sendMail(listOwner, members, message);
      } catch (IOException ioe) {

      Attachments

        1. patch.txt
          3 kB
          Daniel Perry

        Activity

          People

            ieugen Ioan Eugen Stan
            pezzer Daniel Perry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: