Download the PHP package rizwan_47/email-address-verifier without Composer
On this page you can find all versions of the php package rizwan_47/email-address-verifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rizwan_47/email-address-verifier
More information about rizwan_47/email-address-verifier
Files in rizwan_47/email-address-verifier
Package email-address-verifier
Short Description A PHP library for verifying email addresses, ensuring they are valid and reachable. This package provides a straightforward class for email validation processes.
License MIT
Informations about the package email-address-verifier
Email Verifier PHP Library
Introduction
The EmailVerifier library is designed to facilitate comprehensive email validation checks including syntax, domain verification, SMTP connection testing, SPF and DKIM record validation. This robust tool helps in ensuring that an email address is not only formatted correctly but also valid and active, making it an invaluable resource for developers working on email-related functionalities in PHP.
About the Author
Shahzad Ahmad Mirza is a veteran software developer with extensive experience in PHP development. With a career spanning over two decades, Shahzad has contributed to numerous projects and developed several high-quality software solutions. For more information about Shahzad's work, visit his personal website or his company agency website designsvalley.com.
Features
- Syntax Validation: Checks if the email address conforms to the standard email formatting rules.
- Domain Verification: Verifies if the domain of the email address has MX records indicating a capable mail server.
- SMTP Checks: Attempts to establish an SMTP connection to validate the existence and responsiveness of the email address.
- SPF Check: Verifies the presence of SPF records, which are essential for preventing email spoofing.
- DKIM Check: Checks for DKIM records to ensure the email has not been tampered with and is authorized by the domain owner.
Installation
To use EmailVerifier in your project, install the package via composer:
Usage
Here is a simple example demonstrating how to use the EmailVerifier library to verify an email address:
This script will output the verification results, including each test's status and a final score indicating the email's validity.
Example Response
Response Format
When you call the verify()
method on an instance of the EmailVerifier
, it returns an associative array containing detailed results from the verification process. Here's what the response includes:
-
response: A nested array with the results of individual checks, including:
syntax_check
: Indicates whether the email's syntax is correct (passed
orfailed
).domain_check
: Indicates whether the domain has MX records (passed
orfailed
).smtp_check
: Indicates whether the SMTP server accepted the email (passed
orfailed
).spf_check
: Indicates the presence and correctness of SPF records (passed
orfailed
).dkim_check
: Indicates the presence and correctness of DKIM records (passed
orfailed
).
-
score: A numerical score representing the cumulative results of the checks. Each check contributes a predefined weight to the score based on its importance and whether it passed.
- email_details: Provides additional details about the email and its domain, such as:
email_address
: The email address being verified.domain
: The domain of the email address.domain_mx_records
: An array or a string indicating the MX records found or an error message.smtp_ports
: Lists SMTP ports found open during verification.
Here's an example of how the response might look:
License
This library is released under the MIT license. See the LICENSE file for more details.