PHPackages                             codeops/verifyemail - 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. codeops/verifyemail

ActiveLibrary

codeops/verifyemail
===================

PHP class that can be easily used to verify an email address and make sure it is valid and does exist on the mail server.

v10.0.1(7y ago)011ApachePHPPHP &gt;= 5

Since Oct 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/zz/verifyEmail)[ Packagist](https://packagist.org/packages/codeops/verifyemail)[ RSS](/packages/codeops-verifyemail/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (12)Used By (0)

VerifyEmail
===========

[](#verifyemail)

\*\*\* IMPORTANT \*\*\* Due to multiple requests, I now have a supported private repo for the same code that you can get access to. Visit  for details.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#-important--due-to-multiple-requests-i-now-have-a-supported-private-repo-for-the-same-code-that-you-can-get-access-to-visit-httpshbattatcomverifyemailhtml-for-details)

Is a PHP class that can be easily used to verify an email address and make sure it is valid and does exist on the mail server.

This class connects to the mail server and checks whether the mailbox exists or not.

Blog posts:

Description:

How to configure mail server:

How to install (using composer):
================================

[](#how-to-install-using-composer)

Add the package to `composer.json`

```
{
	"require": {
		"hbattat/verifyemail": ""
	}
}

```

Then add the autoload to your file:

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

```

That's all, now you are ready to use that class!

How to use:
===========

[](#how-to-use)

Initialize the class:

```
$ve = new hbattat\VerifyEmail('some.email.address@example.com', 'my.email.address@my-domain.com');
```

OR (you can specify other port number than 25)

```
$ve = new hbattat\VerifyEmail('some.email.address@example.com', 'my.email.address@my-domain.com', 26);
```

The first email address '' is the one to be checked, and the second '' is an email address to be provided to the server. This email needs to be valid and from the same server that the script is running from. To make sure your server is not treated as a spam or gets blacklisted check the score of your server here

Then you call the verify function:

```
var_dump($ve->verify());
```

This will return a boolean. True if the email is valid, false otherwise.

```
bool(true)
```

If you want to get any errors, call this function after the verify function:

```
print_r($ve->get_errors());
```

This will return an array of all errors (if any):

```
Array
(
    [0] => No suitable MX records found.
)
```

If you want to get all debug messages of the connection, call this function:

```
print_r($ve->get_debug());
```

This will return an array of all messages and values that used during the process.

```
Array
(
    [0] => initialized with Email: h*****@gmail.com, Verifier Email: sam@verifye.ml, Port: 25
    [1] => Verify function was called.
    [2] => Finding MX record...
    [3] => Found MX: alt4.gmail-smtp-in.l.google.com
    [4] => Connecting to the server...
    [5] => Connection to server was successful.
    [6] => Starting veriffication...
    [7] => Got a 220 response. Sending HELO...
    [8] => Response: 250 mx.google.com at your service

    [9] => Sending MAIL FROM...
    [10] => Response: 250 2.1.0 OK gw8si3985770wjb.84 - gsmtp

    [11] => Sending RCPT TO...
    [12] => Response: 250 2.1.5 OK gw8si3985770wjb.84 - gsmtp

    [13] => Sending QUIT...
    [14] => Looking for 250 response...
    [15] => Found! Email is valid.
)
```

And to see the *raw* debug messages of the server commands sent

```
print_r($ve->get_debug(true));
```

which will return an array:

```
Array
(
    [helo] => 250 mx.google.com at your service
    [mail_from] => 250 2.1.0 OK a68si4170774ioe.18 - gsmtp
    [rcpt_to] => 250 2.1.5 OK a68si4170774ioe.18 - gsmtp
    [quit] => 4
)

```

Other Examples:
===============

[](#other-examples)

You can also modify/set the values of email to verify, verifier email, and port number on the fly after initializing

```
$ve->set_email('');
$ve->set_verifier_email('');
$ve->set_port();
```

Notes:
======

[](#notes)

- Some mail servers will silently reject the test message, to prevent spammers from checking against their users' emails and filter the valid emails, so this function might not work properly with all mail servers.
- You server must be configured properly as a mail server to avoid being blocked or blacklisted. This includes things like SSL, SPF records, Domain Keys, DMARC records, etc. To check your server use this tool

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 85.4% 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 ~80 days

Recently: every ~189 days

Total

11

Last Release

2697d ago

Major Versions

v1.0.8 → v10.0.02018-12-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4ac4a61a375acd610e910c3a85beace8bf6dedc6c26ce52ba590c094d4755ed?d=identicon)[zhuzhu](/maintainers/zhuzhu)

---

Top Contributors

[![hbattat](https://avatars.githubusercontent.com/u/2022862?v=4)](https://github.com/hbattat "hbattat (41 commits)")[![spartas](https://avatars.githubusercontent.com/u/107970?v=4)](https://github.com/spartas "spartas (5 commits)")[![zz](https://avatars.githubusercontent.com/u/41499?v=4)](https://github.com/zz "zz (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codeops-verifyemail/health.svg)

```
[![Health](https://phpackages.com/badges/codeops-verifyemail/health.svg)](https://phpackages.com/packages/codeops-verifyemail)
```

PHPackages © 2026

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