[MAGNOLIA-1714] Workflow can't send emails to ALL members of a group with class MgnlMailFactory Created: 03/Sep/07  Updated: 15/May/13  Resolved: 03/Sep/07

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 3.0.3
Fix Version/s: 3.0.4, 3.5 RC1

Type: Bug Priority: Major
Reporter: Jürgen Hirt Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
supersession
is superseded by MAGNOLIA-1948 MgnlMailFactory can't read e-mail add... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

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!



 Comments   
Comment by Jürgen Hirt [ 03/Sep/07 ]

see MAGNOLIA-1230

Comment by Magnolia International [ 03/Sep/07 ]

fixed in trunk.
the whole mail module needs testcases. badly.

Comment by Jürgen Hirt [ 03/Sep/07 ]

Thanx !

Is it possible that this fix could also be availble in v3.0.4, and not in v3.1 of magnolia ?

btw: I looked at your modification, doesn't it produce any problems when even after the last address of the list a '\n' is appended ?

Comment by Magnolia International [ 03/Sep/07 ]

It's safe because the method parsing this list thereafter will strip whitelines.
This whole module needs some re-working, hence my comment about testcases.

I'll commit to the 3.0 branch in a minute.

Comment by Magnolia International [ 03/Sep/07 ]

fix merged to magnolia-3.0 branch

Generated at Mon Feb 12 03:29:37 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.