Jump to content

Module: Email Verification


kixe
 Share

Recommended Posts

Email Verification

This module provides functions to validate email adresses and hosts. The module generates a textfile for blacklisted mailhosts (trashmail), which will be always up to date.

Download
https://modules.processwire.com/modules/email-verification/

API

// get module  
$mailcheck = $modules->get('EmailVerification');

// return bool/ string - automatted update of blacklist file
$mailcheck->blacklisted(email|domain)

// return bool - validate a top level domain, checks against IANA list
$mailcheck->validTLD(tld)

// return array of punycoded TLDs - cyclic updated, data pulled from IANA
$mailcheck->getTLDs(cycle=2592000)

// return bool - checks syntax converts to punycode
$mailcheck->validDomainName(domain);

// return bool - checks punycode encoded syntax
$mailcheck->validHostName(host);

// return bool - checks syntax and accessibility
$mailcheck->validHost(email|domain)

// add a single value to blacklist
$mailcheck->addToBlacklist(email|domain)

USAGE

$mailcheck = $modules->get('EmailCheck');

$email = 'susi@trashmail.com';
if($mailcheck->blacklisted($email)) echo 'Email Provider not allowed';
if(!$mailcheck->validHost($email)) echo 'Mailhost not available';

Example blacklist file:  blacklist.txt

 

Edited by kixe
Module update
  • Like 7
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...