Hello Makers, I’m using Gmail’s “Send an email”-module to one or two addresses. The second is optional and not always present, I tried using if and ifempty with null, but the module keeps failing with “Invalid email address in parameter ‘to’” when the second address is empty. It works fine with “copy recipient” but doesn’t with “to”. Thanks!
Hey @Zbulo,
Great to see your question here in the community!
I just wanted to clarify that this is a community of Make users helping out and sharing knowledge. This means we don’t have access to any of your scenarios, organizations etc.
It’s therefore always best to share some screenshots so that the community can see what’s going on in your scenarios visually.
Detailed information could be provided for example by an:
- overview of your scenario setup (functions, mappings, variables etc.)
- the input area of the module you are having trouble with
- the output area of the module you are getting data from
Thank you!
In case you think this is not needed, please disregard this message. I have send this message by automation since you don’t have any attachments.
Did you try putting a 1 in between the brackets for email address 1 and
a 2 in between the brackets for email address 2?
Also use ignore instead of null
Thanks for your input.
- When an address exists, the email is being correctly send.
- It also works when it put the formula from address 2 into cc.
- I tested with ignore/space/false/null but all are resulting in fail.
Toggl the map button for the To section and try
split(email1@test.com, ifempty(email2@test.com;{{emptystring}}) ; ,)
Nice answer. For some reason my brain came up with:
{{remove(add(emptyarray; 1.`My First Email Value`; 1.`My Second Email Value`); null)}}
Both work (though…I’m thinking neither should be required for this simple use case ).
Thanks for both your solutions. The map button was hunting me here.
It indeed really feels like a too complex approach for such a simple job at hand.
Did I get this wrong? It results in a bundle validation error:
Validation failed for 18 parameter(s).
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
Invalid email address in parameter 'to'.
This one did the job.
Apologies for jumping in here, what about if we don’t know the number of recipients for the ‘To’ field? How do we use an array of email addresses?
Did you try compiling a comma separated string of emails and splitting it?
{{remove(add(emptyarray;split(Emails;,);null)}}
Thanks @Zbulo - that helped along the array thinking.
I needed to iterated through some connected fields for multiple emails, building an array and then mapping the array to the correct data.
Appreciate the help.