Problem
Can not use multiple recipients based on component. Steps to reproduce:

- Create a webform.
- Add a selection component.
- Create an e-mail with the following settings in the
To-field: multiple recipients per selection option of the component, see attached screenshot. - The e-mail address values in the component field (marked with
2in the screenshot) are saved with,(comma + space). - If you enter multiple e-mail addresses in the
custom to-field (marked with1in the screenshot), the addresses are saved with,(comma without space) - Problem: the second e-mail address is invalid because of the leading space in
contact@test.com.
Proposed resolution
- Save the e-mail addresses in the component mapping field comma separated only (without spaces).
- Trim the e-mail addresses when sending, to maintain backwards compatibility.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | multiple_mail_recipients_based_on_component-3008142-4.patch | 584 bytes | matthiasm11 |
| e-mail_settings.jpg | 85.85 KB | matthiasm11 |
Comments
Comment #2
matthiasm11 commentedComment #3
matthiasm11 commentedComment #4
matthiasm11 commentedAttached a patch, fixing part 2 of the proposed resolution.
Comment #5
liam morlandComment #6
asvira commentedProposed patch resolves the issue. I confirm that both recipients receive mail after applying the patch.
Comment #7
liam morlandThat fixes part 2 of the solution. There should be a fix for part 1 as well.
Comment #9
liam morlandPart 2 is fixed. Part 1 should be fixed as well.
Comment #10
asvira commentedI have some doubts that we should implement part 1 of proposed solution. Seems that it would be enough if we implement either part 1 or part 2. As we implemented part 2, we do not have any issues with sending mails to multiple recipients. I reviewed code and tested - every address is trimmed when submission mail is going to be sent.
Saved whitespaces after comma do not break anything. One whitespace after comma is useful - it helps to show component value in human-friendly way and allows proper line breaks.
So, this issue can be considered as resolved.
I suggest we handle whitespaces after comma in addresses in separate issue (and comma in name, multiple spaces in name, spaces between name and address)
Comment #11
liam morlandYes, I agree.