Brian Dunning's FileMaker Custom Functions

IsValidEmailƒ ( _email )

test if valid email for format and against current top level domains

  Average rating: 3.6 (60 votes) Log in to vote

Michael Rhodes   Michael Rhodes
Allied Data Service
http://allieddataservice.com

Share on Facebook Share on Twitter

  Sample input:
IsValidEmailƒ ( "mike@allieddataservice.com" )
  Sample output:
1

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

IsValidEmailFormatƒ is a better choice in most situations, since top level domains are constantly created. However, for those who want to test both the format of the email and make sure the top level domain is legitimate according to the current list as of creation date, here is this alternative.

 

Comments

Carl Starr   Carl Starr, Albuquerqre, NM
Mar 23, 2009
Good custom function. Appreciate how it picks up leading spaces as invalid format. I will use it.
 
Michael Rhodes   Michael Rhodes, Rancho Cucamonga
Apr 13, 2009
Carl,

Thanks for the positive feedback..
 
Philippe Lazzaroni   Philippe Lazzaroni, Montreal, Qc
Oct 1, 2009
myname@yrdsb.edu.on.ca returns 0
myname@logisoft.qc.ca returns 0

It would be a great addition to support domains made of multiple extensions.
 
Michael McCoy   Michael McCoy, Columbus, OH
Nov 2, 2009
Love the function, however if I type an e-mail address into the field being validated by your function and then decide I do not want an address there and attempt to delete it, the validation fails trying to evaluate the empty string. Just needs an isempty test. Thanks!
 
Mike Kowalski   Mike Kowalski, Monster Town, MI
Nov 16, 2009
Yes, it would be a great addition to support domains made of multiple extensions.
 
Paolo Casagrande   Paolo Casagrande, Trento - Italy
Apr 22, 2010
Very useful function, but name.surname@dom.city.it return 0

i have modified your function with:
posDom = Position ( email; "@"; 1; 1 ) + 1 ;
user = Left ( email; posDom - 2 ) ;
nrDotUser = PatternCount ( user; "." );
nrDot = PatternCount ( email ; "." );
posTLD = Position ( email; "."; posDom + 1; nrDot - nrDotUser ) ;
dom = Middle ( email; posDom; posTLD - posDom ) ;
tld = Right ( email; Length ( email ) - posTLD )

now it's work ;-)
 
Chris D'Angelo   Chris D'Angelo, New York, NY
Oct 28, 2010
Thanks to Paolo and to Brian Dunning!
 
Michael Rhodes   Michael Rhodes, Rancho Cucamonga
Dec 5, 2010
I really don't like this function because the top level domains can change. Please use my similar custom function IsValidEmailFormat.
 
Michael Rhodes   Michael Rhodes, Rancho Cucamonga
Dec 5, 2010
Try the update I just posted.
 
Jamie Thompson, Computech IT Services Ltd.   Jamie Thompson, Computech IT Services Ltd., Plymouth, UK
Mar 10, 2011
Great function. However, the ampersand (&) is a valid character in an email address.


http://www.BusinessManCRM.com
 
John   John
Apr 16, 2014
Unfortunately, this doesn't properly validate *any* multi-part domains, like the Office 365 native domains that look like "user@company.onmicrosoft.com". Paolo's modifications allow it to work for those as well, however.
 
JohnD   JohnD, PA
May 19, 2015
This function allows an underscore character to be in the domain name part of the address (after the "@"), but an underscore is not a legal character in a domain name (it's fine in the username part, i.e. before the "@").

There is apparently some argument about whether underscores are *technically* permitted by the RFCs in the domain part, but in practice they are *not* allowed and will be rejected.

So to validate the domain part properly to allow only alphanums, hypens and dots, I added this line to this function, just below the first "Filter" statement:

and Filter (dom; alphanum & "-.") = dom // There are only alphanumerics, dashes and dots in the domain
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.