mitmelon/email_horse

This package is abandoned and no longer maintained. The author suggests using the egulias/email-validator package instead.

Class to validate and verify email address

1.0.0 2020-01-18 16:43 UTC

This package is auto-updated.

Last update: 2022-08-15 08:37:27 UTC


README

FOSSA Status

Email_Horse v1.0.0

Email Horse is an email validation class to verify the presence of email. The Email_Horse class is used to check if an email address is valid and real using SMTP protocol in PHP. You need to use one function of Email_Horse class to verify the email address in PHP.

Email_Horse Does the followings

  1. Validate the format of the email address.
  2. Get MX records of the domain of the email address.
  3. Connect to the SMTP server by the MX records.
  4. Check if given recipient email address is valid.
  5. Check if the user of email's domain exists.

Install:

Use composer to install

composer require mitmelon/email_horse

Class Usage :

require_once __DIR__."/vendor/autoload.php";

// Initialize library class
$mail = new Email_Horse();

// Set the timeout value on stream
$mail->setStreamTimeoutWait(20);

// Set debug output mode
$mail->Debug= TRUE; 
$mail->Debugoutput= 'html'; 

// Set email address for SMTP request
$mail->setEmailFrom('from@email.com');

// Email to check/validate
$email = 'email@example.com'; 

// Check if email is valid and exist
if($mail->check($email)){ 
    echo 'Email <'.$email.'> is exist!'; 
}elseif($mail::validate($email)){ 
    echo 'Email <'.$email.'> is valid, but not exist!'; 
}else{ 
    echo 'Email <'.$email.'> is not valid and not exist!'; 
} 

License

Released under the MIT license

FOSSA Status