Git Product home page Git Product logo

smtp-validator-email's Introduction

#Smtp Validator Emails Build Status

  • Smtp Validator mail can validate your email to send smtp mail and check your mx.

#Requirements

  • PHP >= 5.4
  • namespaces use
  • smtp configuration PHP Ok.

#Installation For installation you can use composer.

Simple add "ddtraceweb/smtp-validator-email": "dev-master" in your composer.json to install the latest version

#examples :

  • example with 1 email :
<?php

use SmtpValidatorEmail\ValidatorEmail;

$from = '[email protected]'; // for SMTP FROM:<> command
$emails = '[email protected]';

$validator = new ValidatorEmail($email, $from);

var_dump($validator->getResults());
?>
  • example with X emails :
<?php

use SmtpValidatorEmail\ValidatorEmail;

$from = '[email protected]'; // for SMTP FROM:<> command
$emails = array('[email protected]', '[email protected]');

$validator = new ValidatorEmail($email, $from);

var_dump($validator->getResults());
?>
  • example with X emails and have custom delays time when connection and send HELO, with domain need time to respond.
<?php

use SmtpValidatorEmail\ValidatorEmail;

$from = '[email protected]'; // for SMTP FROM:<> command
$emails = array('[email protected]', '[email protected]');

//two loops in this example for difficult domains.
$options = array('delaySleep' => array(0, 6));

//Handle $options to the constructor as third parameter
$validator = new ValidatorEmail($email, $from, $options);

var_dump($validator->getResults());
?>
  • example with X emails with more informations on domain, mxs and priorities.
<?php

use SmtpValidatorEmail\ValidatorEmail;

$from = '[email protected]'; // for SMTP FROM:<> command
$emails = array('[email protected]', '[email protected]');

//more informations option activate
$options = array('domainMoreInfo' => true);

//Handle $options to the constructor as third parameter
$validator = new ValidatorEmail($email, $from, $options);

var_dump($validator->getResults());
?>
  • example with X emails with more informations on domain, mxs and priorities. In example same domain for two email. This is a connection to domain and check all account emails.
<?php

use SmtpValidatorEmail\ValidatorEmail;

$from = '[email protected]'; // for SMTP FROM:<> command
$emails = array('[email protected]', '[email protected]');

//more informations option activate
$options = array('domainMoreInfo' => true);

//Handle $options to the constructor as third parameter
$validator = new ValidatorEmail($email, $from, $options);

var_dump($validator->getResults());
?>
  • example with 1 email with using a specific interface with debug mode ON:
<?php

use SmtpValidatorEmail\ValidatorEmail;

$from = '[email protected]'; // for SMTP FROM:<> command
$emails = '[email protected]';

$validator = new ValidatorEmail($email, $from, array('debug' => true, 'context' => 'socket' => array('bindto' => '0.0.0.0')));

var_dump($validator->getResults());
var_dump($validator->getDebug());
?>
  • Available default options
array(
  'domainMoreInfo' => false,
  'delaySleep' => array(0),
  'noCommIsValid' => 0,
  'catchAllIsValid' => 0,
  'catchAllEnabled' => 1,
  'timeout' => null, // ini_get("default_socket_timeout")
  'context' => array(),
  'detailResults' => false, // Instead of returning 0 for invalid and 1 for valid, it will return an array. array('result' => $isValid /* 0 or 1 */, 'info' => "<SMTP response like: 250 2.1.5 Ok>")
  'debug' => false
);

smtp-validator-email's People

Contributors

b1rdex avatar bitdeli-chef avatar daviddjian avatar ddtraceweb avatar jverb avatar opb avatar rubencodeforges avatar smatyas avatar thinkspill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

smtp-validator-email's Issues

Timeout breaks validation

Hey there! First for all thanks for this nice oop styled validator!

Got some question to you , is it possible to change some part of the Smtp class .
The point is that if we got a timeout here :

//# Smtp.php


            // have we timed out?
            $info = stream_get_meta_data($this->socket);
            if (!empty($info['timed_out'])) {
                throw new ExceptionTimeout('Timed out in recv');
            }
            // did we actually receive anything?
            if ($line === false) {

We got an exception , this breaks the validation process for all email , can it be instead just adding some information to the results , for example an email is marked as timeout in the results ?

I can do it sure by my self , but my project is build on symfony and i have many dependencys in the composer.json , so on deploy i will have to manualy edit your lib , this is not very handy.

Returned array descriptions

Hi again , perhaps it where good to give a small description of the array that is returned after validation and with the option ( domainMoreInfo => true )

Connection timeout

Hello! I need to set connection timeout in SMTP. How i could do that?

Symfoyn 2 components

Hi there , im currently reworking the lib , i want to decouple it a bit and make it more easy to maintain.
There for im using some symfony 2 components , the first one is the config component, you can check it out my fork , the second will be the core of the rework , the event dispatcher .

The event dispatcher use the mediatior pattern and it will help do decouple things and make them easy to extend.

Perhaps you dont need it in your lib , but i need it to do for my project .

I cant get it run ?

sorry for this
I downloaded the latest version clone
I cant get it run
I have a localserver and online server but i donot know where to start ?!

BUGS

Found bugs in the new version , do not release it.
Tweaks are in progress

Headers logger

For debugging when working with large amounts of emails , a headers logger would be a great idea to look for X-Rate-Limit that appear when you are near getting blocked.

Error with several users from same domain

In:
public function rcpt($to)
If Exception\ExceptionUnexpectedResponse is throw:
$this->statusManager->setStatus($this->users, new Domain($this->domain), 0, 'UnexpectedResponse: ' . $e->getMessage());

If you have one user with positive response,this result will be overwritter by this setStatus, because all users are included in $this->users.
Only the incorrect usershould to be included in setStatus call.

You can reproduce the issue with:

$emails = array('[email protected]', '[email protected]');
$validator = new ValidatorEmail($emails, $from, array('detailResults' => true, 'catchAllEnabled' => false, 'debug' => true, 'domainMoreInfo' => true));
print_r($validator->getResults());


Can't establish connection using proxy.

I know your not on PHP any more. Any ideas how to use this via a proxy?

I have tried using your example by adding socked and bindo to into the context.

i have removed the @ symbol in the SMTP class so it fails straight away when trying to make the connection if the proxy is invalid. if i comment out the proxy in the context it connects fine.

Can you tell me what proxy protocol behind the scenes is required for this to work? Connect:25 or 80?

Even results

Hi , there seems to give same results as with valid and invalid email.
ive tried it on my mail server with existing and unexisting user.

Also ive tried the non namespace version of this validator, it worked there, but i like to use namespaces.

Question: Http proxy?

Hello , is actually possible to use a proxy , so that the script will use not its server ip but those from a proxy, to prevent bans and greylisting ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.