2017 © Pedro Peláez
 

library email-checker

PHP email validator using SMTP

image

sorciulus/email-checker

PHP email validator using SMTP

  • Wednesday, October 18, 2017
  • by sorciulus
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Email Checker

Packagist Build Status Scrutinizer Code Quality Code Climate Issue Count PHP Version Software License, (*1)

PHP library to check if an email exists to SMTP Server and check if email is Disponsable from https://open.kickbox.io API., (*2)

Installation

Via Composer:, (*3)

composer require sorciulus/email-checker

Usage

Basic use of EmailChecker with email argument constructor :, (*4)

<?php
require_once 'vendor/autoload.php';

use sorciulus\EmailChecker\EmailChecker;
use sorciulus\EmailChecker\Exception\EmailCheckerException;
try {
    $check = new EmailChecker("foo@rmqkr.net", "sender@email.com");
    $result = $check->validate()->isValid(); // instance of ResponseChecker
    if ($result) {
        echo "Email is valid";
    } else {
        echo "Email not valid";
    }   
} catch (EmailCheckerException $ex) {
    echo $ex->getMessage(); 
}

use EmailChecker to check if email is Disponsable:, (*5)

<?php
require_once 'vendor/autoload.php';

use sorciulus\EmailChecker\EmailChecker;
use sorciulus\EmailChecker\Exception\EmailCheckerException;
try {
    $check = new EmailChecker();
    $disponsibleService = $check->getDisponsableService();  
    // You can use email or domain
    if ($disponsibleService->isDisponsable("gucu@asorent.com")) {
        echo "Email is disponsable";
    } else {
        echo "Email not disponsable";
    }
} catch (EmailCheckerException $ex) {
    echo $ex->getMessage(); 
}

Loop usage of EmailChecker with setEmail method :, (*6)

<?php
require_once 'vendor/autoload.php';

use sorciulus\EmailChecker\EmailChecker;
use sorciulus\EmailChecker\Exception\EmailCheckerException;
$emails = ["bar@rmqkr.net", "foo@rmqkr.net", "vakol@yopmail.com"];
$check = new EmailChecker("vufeti@vipepe.com");
// you can set Sender outside loop 
// $check->setSender("sender@email.com");
foreach($emails as $email) {
    try {
        // or you can set Sender inside loop 
        //$check->setSender("sender@email.com");
        $check->setEmail($email);
        $result = $check->validate()->isValid(); // instance of ResponseChecker
        if ($result) {
            echo "Email is valid";
        } else {
            echo "Email not valid";
        }   
    } catch (EmailCheckerException $ex) {
        echo $ex->getMessage(); 
    }
}

Debugging is always present in both the ResponseChecker object and in the EmailCheckerException :, (*7)

```php try { $check = new EmailChecker("foo@rmqkr.net"); $result = $check->validate(); // instance of ResponseChecker $debug = $result->getDebug(); if ($result->isValid()) { echo "Email is valid"; } else { echo "Email not valid"; }
} catch (EmailCheckerException $ex) { $debug = $ex->getDebug(); echo $ex->getMessage(); }, (*8)

The debug is an array of SMTP command executed and relative response .

> In case of massive use i would suggest using a machine side proxy.

### Laravel 5
Once this operation is complete, simply add the service provider class to your project's `config/app.php` file:

#### Service Provider
```php
sorciulus\EmailChecker\Laravel\EmailCheckerServiceProvider::class,

Facade

To use facade you have to add this line in config/app.php in aliases array, (*9)

'EmailChecker' => sorciulus\EmailChecker\Laravel\Facades\EmailChecker::class,

Example Usage With Facade

```php use \EmailChecker; use sorciulus\EmailChecker\Exception\EmailCheckerException;, (*10)

try{ EmailChecker::setEmail("foo@rmqkr.net"); $validate = EmailChecker::validate();
if ($validate->isValid()) { echo "Email is valid"; } else { echo "Email not valid"; } } catch (EmailCheckerException $e) { echo $e->getMessage(); }, (*11)

```, (*12)


Todos

  • Integration with Symfony2

License

This Library is released under the MIT License. Please see License File for more information., (*13)

The Versions

18/10 2017

dev-master

9999999-dev

PHP email validator using SMTP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Corrado Ronci

email php smtp checker disponsable

18/10 2017

0.3.1

0.3.1.0

PHP email validator using SMTP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Corrado Ronci

email php smtp checker

18/10 2017

0.3.0

0.3.0.0

PHP email validator using SMTP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Corrado Ronci

email php smtp checker

19/09 2017

0.2.0

0.2.0.0

PHP email validator using SMTP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Corrado Ronci

email php smtp checker

14/09 2017

0.1.0

0.1.0.0

PHP email validator using SMTP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Corrado Ronci

email php smtp checker