Copy recipient sending email for only one cc

I got just the solution for you. The issue was that the CCs are in a single comma-separated variable in an array.

You can use the built-in function replace with this Pattern (regular expression):

(?:[^>]*?<|>(?:,?\s*|$))

e.g.:

{{split(replace(2.headers.cc[]; "/(?:[^>]*?<|>(?:,?\s*|$))/g"; "|"); "|")}}

Proof https://regex101.com/r/lMIh6P/1

Screenshot

Screenshot_2024-08-15_130845

Output

Screenshot_2024-08-15_130835

Then you can map this directly in the CC field:

Screenshot_2024-08-15_130834


For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{"subflows":[{"flow":[{"id":125,"module":"util:SetVariable2","version":1,"parameters":{},"mapper":{"name":"cc_array","scope":"roundtrip","value":"{{split(replace(2.headers.cc[]; \"/(?:[^>]*?<|>(?:,?\\s*|$))/g\"; \"|\"); \"|\")}}"},"metadata":{"designer":{"x":1959,"y":21,"name":"Build CC Email Array"}}}]}],"metadata":{"version":1}}

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

1 Like