PHPackages                             myamwso/smtp-validate-email - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. myamwso/smtp-validate-email

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

myamwso/smtp-validate-email
===========================

Perform email address verification via SMTP

2.2.6(7y ago)0159GPL-3.0+PHPPHP &gt;=5.6

Since Oct 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Myamwso/smtp-validate-email)[ Packagist](https://packagist.org/packages/myamwso/smtp-validate-email)[ RSS](/packages/myamwso-smtp-validate-email/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)DependenciesVersions (30)Used By (0)

SMTP\_Validate\_Email
=====================

[](#smtp_validate_email)

Perform email address validation/verification via SMTP.

The `SMTPValidateEmail\Validator` class retrieves MX records for the email domain and then connects to the domain's SMTP server to try figuring out if the address really exists.

Earlier versions (before 1.0) used the `SMTP_Validate_Email` class name (and did not use namespaces and other now-common PHP features). Care has been taken to keep the old API and migrating old code should be painless. See ["Migrating to 1.0 from older versions"](#migrating-to-1.0-from-older-versions) section. Or just use/download the ancient [0.7 version](https://github.com/zytzagoo/smtp-validate-email/releases/tag/v0.7).

Features
--------

[](#features)

- Not actually sending the message, gracefully resetting the SMTP session when done
- Command-specific communication timeouts implemented per relevant RFCs
- Catch-all account detection
- Batch mode processing supported
- Logging/debugging support
- No external dependencies
- Covered with unit/functional tests

Installation
------------

[](#installation)

Install via [composer](https://getcomposer.org/):

`composer require myamwso/smtp-validate-email --update-no-dev`

Usage examples
--------------

[](#usage-examples)

### Basic example

[](#basic-example)

```
require 'vendor/autoload.php';

use SMTPValidateEmail\Validator as SmtpEmailValidator;

/**
 * Simple example
 */
$email     = 'someone@example.org';
$sender    = 'sender@example.org';
$validator = new SmtpEmailValidator($email, $sender);

// If debug mode is turned on, logged data is printed as it happens:
// $validator->debug = true;
$results   = $validator->validate();

var_dump($results);

// Get log data (log data is always collected)
$log = $validator->getLog();
var_dump($log);
```

### Multiple recipients and other details

[](#multiple-recipients-and-other-details)

```
require 'vendor/autoload.php';

use SMTPValidateEmail\Validator as SmtpEmailValidator;

/**
 * Validating multiple addresses/recipients at once:
 * (checking multiple addresses belonging to the same server
 * uses a single connection)
 */
$emails    = [
    'someone@example.org',
    'someone.else@example.com'
];
$sender    = 'sender@example.org';
$validator = new SmtpEmailValidator($email, $sender):
$results   = $validator->validate();

var_dump($results);

/**
 * The `validate()` method accepts the same parameters
 * as the constructor, so this is equivalent to the above:
 */
$emails    = [
    'someone@example.org',
    'someone.else@example.com'
];
$sender    = 'sender@example.org';
$validator = new SmtpEmailValidator():
$results   = $validator->validate($emails, $sender);

var_dump($results);
```

Migrating to 1.0 from older versions
------------------------------------

[](#migrating-to-10-from-older-versions)

Earlier versions used the global `SMTP_Validate_Email` classname. You can keep using that name in your existing code and still switch to the newer (composer-powered) version by using [aliasing/importing](http://php.net/manual/en/language.namespaces.importing.php) like this:

Require the composer package:

`composer require myamwso/smtp-validate-email --update-no-dev`

And then in your code:

```
require 'vendor/autoload.php';

use SMTPValidateEmail\Validator as SMTP_Validate_Email;

// Now any old code referencing `SMTP_Validate_Email` should still work as it did earlier
```

Development &amp; Contributions
-------------------------------

[](#development--contributions)

See the [Makefile](Makefile) and the development dependencies in [composer.json](composer.json) and [package.json](package.json).

Running `make` once you clone (or download) the repository gives you:

```
Usage: make [target]

[target]                       help
--------                       ----
help                           What you're currently reading
install                        Installs dev dependencies
test                           Runs tests
coverage                       Runs tests with code coverage
$(PIDFILE)                     Starts the smtp-sink server
server-start                   Stops and starts the smtp-sink server
server-stop                    Stops smtp-sink server if it's running
clean                          Removes installed dev dependencies

```

So, run `make install` to get started. Afterwards you should be able to run the tests.

Tests are powered by `phpunit` and a local `smtp-sink` instance running on port 1025. If `smtp-sink` is unavailable, tests requiring it are marked as skipped.

Pull requests are welcome!

In order to get your pull-request merged, please follow these simple rules:

- all code submissions must pass cleanly (no errors) with `make test`
- stick to existing code style (`phpcs` is used)
- there should be no external dependencies
- if you want to add significant features/dependencies, file an issue about it first so we can discuss whether the addition makes sense for the project

[Changelog](CHANGELOG.md)
-------------------------

[](#changelog)

[License (GPL-3.0+)](LICENSE.txt)
---------------------------------

[](#license-gpl-30)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Recently: every ~34 days

Total

28

Last Release

2592d ago

Major Versions

1.0 → 2.02018-10-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/924646859da360b931c1792d60cc3d8899dfa0acce3effecfc67eedf0e58432b?d=identicon)[huangjie](/maintainers/huangjie)

---

Top Contributors

[![Myamwso](https://avatars.githubusercontent.com/u/15210427?v=4)](https://github.com/Myamwso "Myamwso (4 commits)")

---

Tags

validatoremailverifysmtp

### Embed Badge

![Health badge](/badges/myamwso-smtp-validate-email/health.svg)

```
[![Health](https://phpackages.com/badges/myamwso-smtp-validate-email/health.svg)](https://phpackages.com/packages/myamwso-smtp-validate-email)
```

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[zytzagoo/smtp-validate-email

Perform email address verification via SMTP

452909.9k3](/packages/zytzagoo-smtp-validate-email)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[mageplaza/module-smtp

SMTP Extension for Magento 2 helps the owner of store simply install SMTP (Simple Mail Transfer Protocol) server which transmits the messages into codes or numbers

3015.9M8](/packages/mageplaza-module-smtp)[aplus/email

Aplus Framework Email Library

2461.6M3](/packages/aplus-email)[sendgrid/smtpapi

Build SendGrid X-SMTPAPI headers in PHP.

696.5M2](/packages/sendgrid-smtpapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
