Skip to content
Simple Class for Validating Email Address Syntax in Pascal/Delphi
Branch: master
Clone or download
Latest commit 7bd1346 Feb 20, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
EmailValidation.Test Sync current branch with parent branch Apr 23, 2017
EmailValidatorOneBasedIndex Sync current branch with parent branch Apr 23, 2017
EmailValidatorZeroBasedIndex Sync current branch with parent branch Apr 23, 2017
.gitattributes 🍭 Added .gitattributes & .gitignore files Jul 16, 2015
.gitignore 🍭 Added .gitattributes & .gitignore files Jul 16, 2015
EmailValidation.groupproj
LICENSE.md Various Improvements Mar 26, 2016
README.md Updated README. Feb 19, 2018

README.md

#EmailValidationPascal#

This is a Port of EmailValidation to Delphi/Pascal.

A simple (but correct) Pascal class for validating email addresses.

Supports Internationalized Mail Address standards (rfc653x).

Building

This project was created using Delphi 10 Seattle Update 1. The (uEmailValidation.pas) unit should compile in any Delphi version from 2009 and FreePascal 2.6.4 Upwards.

if you are using XE3 Upwards and working with the Mobile compilers in which strings are Zero-Based by Default, Please use the (uEmailValidationZeroBased.pas) unit else any of the units you like.

  • FreePascal Users and Delphi Users below XE3 can Only use the (uEmailValidation.pas) unit.

###Code Examples

	uses
	    SysUtils, uEmailValidation;
	var
	  TestAddress : String;	
	begin
	  TestAddress := '_somename@example.com';
	  Validator := TEmailValidator.Create;
	 if TEmailValidator.Validate(TestAddress) then
	begin
	  WriteLn('Valid Email Address');
	  ReadLn;
	end
	else
	begin
	  WriteLn('Invalid Email Address')
	  ReadLn;
	end;
    end;

For International Addresses

    uses
	    SysUtils, uEmailValidation;
	var
	  TestAddress : String;
	begin
	  TestAddress := 'θσερ@εχαμπλε.ψομ';
	 if TEmailValidator.Validate(TestAddress, True) then
	begin
	  WriteLn('Valid Email Address');
	  ReadLn;
	end
	else
	begin
	  WriteLn('Invalid Email Address')
	  ReadLn;
	end;
    end;

###Unit Tests

Unit Tests can be found in EmailValidation.Test Folder.
The unit tests makes use of DUnitX and TestInsight.

###License

This "Software" is Licensed Under MIT License (MIT) .

Tip Jar

  • 💵 Bitcoin: 1MhFfW7tDuEHQSgie65uJcAfJgCNchGeKf
  • 💶 Ethereum: 0x6c1DC21aeC49A822A4f1E3bf07c623C2C1978a98
  • 💷 Pascalcoin: 345367-40

###Conclusion

Special Thanks to Jeffrey Stedfast for this awesome library. (Thanks to the developers of DUnitX Testing Framework and TestInsight for making tools that simplifies unit testing.

You can’t perform that action at this time.