Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-1714

Workflow can't send emails to ALL members of a group with class MgnlMailFactory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.0.4, 3.5 RC1
    • 3.0.3
    • None
    • None

      There's still a bug in that class when an email has to be sent to all members of a group.
      The addresses are not separated properly with that \n character:

      Look at the code:

      ...
      else if (userName.startsWith(MailConstants.PREFIX_GROUP)) {

      userName = StringUtils.removeStart(userName, MailConstants.PREFIX_GROUP);

      try {

      HierarchyManager hm = ContentRepository.getHierarchyManager(ContentRepository.USERS);

      Collection users = hm.getRoot().getChildren(ItemType.USER);

      Iterator iter = users.iterator();

      while(iter.hasNext()){

      Content userNode = ((Content) iter.next());

      MgnlUserManager manager = new MgnlUserManager();

      MgnlUser user = (MgnlUser) manager.getUser(userNode.getName());

      if (user.getGroups().contains(userName))

      { ret.append(getUserMail(user.getName())); }


      }
      }
      catch (Exception e)

      { log.error("can not get user email info."); }

      }
      ...

      the command
      ret.append(getUserMail(user.getName()));

      just concatinates the adresses. Therefore in the end you have just only one big WRONG email address like, e.g.:
      username1@company.comusername2@company.comusername3@company.com

      ...and finally: it doesn't work!

        Acceptance criteria

              gjoseph Magnolia International
              killbill Jürgen Hirt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD