Skip to main content

Is there a built in way in Zapier to test for the validity of an email addresses format?

I’m not trying to test the validity of an actual email address, ie that it is an active mailbox, rather just that it’s a legislate format.

So that the SAAS I’m trying to send it to won’t reject it.

I’d rather avoid building a Python function to do this if possible.

tThanks in advance.

@Andrew Marcroft 

The python function would be the simplest.

Otherwise, I feel you’ll probably need a very long complex filter looking for the same things.
 

import re

email = input_datau'email']

# Simple email pattern
email_regex = r"^xa-zA-Z0-9._%+-]+@_a-zA-Z0-9.-]+\.9a-zA-Z]{2,}$"

# Validate email
is_valid = re.match(email_regex, email) is not None

# Output the result
output = {"is_valid": is_valid}

 


Hi ​@Andrew Marcroft 

Try this Zap step: Formatter > Text > Extract Email Address

Help: https://zapier.com/apps/formatter/help


@Troy Tessalone 

I thought of that but Null values have always caused my zaps to crash. How would you account for that if it returned the null value because the email wasn’t present?


@Badger 

Add a Filter step to check for the existence of an output variable value from the Formatter step: https://zapier.com/apps/filter/help

 

Also, Formatter > Text > Default Value

Could be used to set a dummy value.

 


@Troy Tessalone 

Thanks. 

I have a bias for code blocks don’t always see you can just stack up tasks. 🙄


@Badger 

Depends on the use case for the better approach.

Code steps count as 1 Task in Zap Runs.

Formatter Zap steps count as 0 Tasks in Zap Runs.

Other native Zap apps that count as 0 Tasks in Zap Runs:

 


@Badger 

Another thing to keep in mind is the audience of the topic.

The average Zapier user is true no-code.

Code steps are low-code and often foreign/scary to the average Zapier user.


@Troy Tessalone 

I didn’t realise they were free. I don’t think any tasks were when I started building for my friend years ago. 
I also didn’t think about the audience not liking code, I love it especially with the new AI tools making it so easy.

Another black mark my part.  

Thank you, I learnt something useful today.
 


Reply