apavliukov/laravel-email-smtp-validation

Validate email address via SMTP to check if it really exists
28,285 1
Install
composer require apavliukov/laravel-email-smtp-validation
Latest Version:1.0.6
PHP:^7.4|^8.0
License:MIT
Last Updated:Jun 25, 2024
Links: GitHub  ·  Packagist
Maintainer: apavliukov

Laravel Email SMTP Validation

Laravel package for simpler usage of zytzagoo/smtp-validate-email package to check if email really exists. It 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.

Installation

composer require apavliukov/laravel-email-smtp-validation

Usage

Config

You can copy config file

php artisan vendor:publish --tag=email-smtp-validation-config

If you want to disable SMTP check on some environments, you can pass them in config on key disable_on_env. By default, local env is disabled to allow you to use fake emails during development.

Rule

For example, in your request class you can use Rules\EmailSmtpVerified rule like here

use AlexPavliukov\EmailSmtpValidation\Rules\EmailSmtpVerified;
...

class ValidateEmailRequest extends FormRequest
{
    public function rules()
    {
        return [
            'email' => [
                'required',
                'email',
                app(EmailSmtpVerified::class),
            ],
        ];
    }
}

Related Packages

stuyam/laravel-kickbox-validator

A kickbox email validator for form requests in laravel

10,086 4
tyondo/laravel-notifications

User notifications via email for Laravel 5.3 and 5.4.

50 0
groundsix/laravel-neverbounce

Laravel style wrapper for https://github.com/NeverBounce/NeverBounceAPI-PHP

5,358 2
hamedmehryar/laravel-kickbox-validator

A kickbox email validator for form requests in laravel (forked from 'stayum')

62 1
lakshmaji-ananth/spotmail

Checks whether email exists in real world

16 0