Disposable email address validator for Laravel

Overview

Laravel Disposable Email

Tests Latest Stable Version Total Downloads License

Adds a validator to Laravel for checking whether a given email address isn't originating from disposable email services such as Mailinator, Guerillamail, ... Uses the disposable domains blacklist from andreis/disposable-email-domains by default.

Installation

  1. Run the Composer require command to install the package:

    composer require propaganistas/laravel-disposable-email
  2. If you don't use auto-discovery, open up your app config and add the Service Provider to the $providers array:

    'providers' => [
       ...
    
       Propaganistas\LaravelDisposableEmail\DisposableEmailServiceProvider::class,
    ],
  3. Publish the configuration file and adapt the configuration as desired:

    php artisan vendor:publish --tag=laravel-disposable-email
  4. Run the following artisan command to fetch an up-to-date list of disposable domains:

    php artisan disposable:update
  5. (optional) In your languages directory, add for each language an extra language line for the validator:

    'indisposable' => 'Disposable email addresses are not allowed.',
  6. (optional) It's highly advised to update the disposable domains list regularly. You can either run the command yourself now and then or, if you make use of Laravel's scheduler, include it over there (App\Console\Kernel):

    protected function schedule(Schedule $schedule)
    {
        $schedule->command('disposable:update')->weekly();
    }

Usage

Use the indisposable validator to ensure a given field doesn't hold a disposable email address. You'll probably want to add it after the email validator to make sure a valid email is passed through:

'field' => 'email|indisposable',

Custom fetches

By default the package retrieves a new list by using file_get_contents(). If your application has different needs (e.g. when behind a proxy) please review the disposable-email.fetcher configuration value.

Comments
  • Updated package compatibility.

    Updated package compatibility.

    The \Illuminate\Support\Str::after() method used in the indisposable validator was added in version 5.4 of illuminate/support, which makes this package incompatible with earlier versions.

    This pull request updates the illuminate/support version requirement in composer.json to 5.4.* and adds a compatibility notice in the README.md. :smile:

    opened by JorgenVatle 11
  • 2.1.0 give in_array(): Argument #2 ($haystack) must be of type array, string given exception

    2.1.0 give in_array(): Argument #2 ($haystack) must be of type array, string given exception

    I got the following error in the latest version (2.1.0). Downgrading to 2.0.19 fixes it

    in_array(): Argument #2 ($haystack) must be of type array, string given

    public function isDisposable($email)
        {
            if ($domain = Str::lower(Arr::get(explode('@', $email, 2), 1))) {
                return in_array($domain, $this->domains); // This line
    
    
    opened by ziming 4
  • propaganistas/laravel-cache-keywords IS DELETED???

    propaganistas/laravel-cache-keywords IS DELETED???

    sorry for writing this here

    propaganistas/laravel-cache-keywords IS DELETED???

    I was using this in many projects nd now ALL are broken!

    can you please bring this back? or at least send me the zip to add on my account?

    opened by unitedworx 4
  • Feature request - use curl instead of file_get_contents

    Feature request - use curl instead of file_get_contents

    https://github.com/Propaganistas/Laravel-Disposable-Email/blob/1f7d721c37845d390dffb38c27b1a361b40ac13e/src/Console/UpdateDisposableDomainsCommand.php#L107

    Probably add a way to download the file with curl, as in many cases php is set with "allow_url_fopen = Off" on production environments for security reasons, so file_get_contents doesn't work with URLs.

    Thanks.

    opened by atanas18 2
  • [Feature Request] Update list from behind a proxy

    [Feature Request] Update list from behind a proxy

    Currently when behind a proxy running the update artisan command gets the unable to reach source error message.

    If the artisan command is passed an option would it be possible to grab a field, such as INTERNAL_PROXY from the .env file or something from the config, to be able to grab the updated list when behind a proxy?

    https://stackoverflow.com/questions/1336262/file-get-contents-behind-a-proxy

    opened by JavanCook 2
  • Fix unserialize() error when using Redis as cache

    Fix unserialize() error when using Redis as cache

    Using the key disposable_email.domains in Redis throw an error unserialize(): Error at offset XYZ of XYZ bytes, Redis cannot unserialize keys with dot notation. Is better to replace the key with underscore so it works in most cache drivers.

    opened by kitro 1
  • [Security] Workflow tests.yml is using vulnerable action actions/checkout

    [Security] Workflow tests.yml is using vulnerable action actions/checkout

    The workflow tests.yml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability. The vulnerability fix that is missing by actions version could be related to: (1) CVE fix (2) upgrade of vulnerable dependency (3) fix to secret leak and others. Please consider to update the reference to the action.

    opened by akulpillai 1
  • Changed command to make it works with lumen

    Changed command to make it works with lumen

    This change allow to use this plugin also in a Lumen project. I've only used the config helper instead of the config->get method and everything works as expected.

    Hope you can merge asap.

    Luca.

    https://laravel.com/docs/8.x/configuration#accessing-configuration-values https://lumen.laravel.com/docs/8.x/configuration#accessing-configuration-values

    opened by lucacerretani 1
  • Add multiple lists?

    Add multiple lists?

    I am using a public disposable e-mail domain list but I would also like to keep my own local list and have this package use both? Is that possible right now?

    opened by Fossil01 1
  • lowercase domain

    lowercase domain

    Function in_array() is case-sensitive. If the example.com domain is in the blacklist, then Example.com it passes validation. RFC 1035 domain is case-insensitive. Therefore, it can be converted to lowercase before validation.

    opened by tohtamysh 1
  • There are no commands defined in the

    There are no commands defined in the "disposable" namespace.

    when i follow your installation and do php artisan disposable:update

    I get this errror There are no commands defined in the "disposable" namespace.

    opened by yormy 1
Releases(2.1.16)
Owner
null
:envelope: E-Mail Address Validator (syntax, dns, trash, typo)

✉️ E-Mail Address Validator for PHP Warning The best way to validate an e-mail address is still to send a duplicate opt-in-mail, when the user clicks

Lars Moelleken 39 Jul 28, 2022
Email address value object.

Email address value object Installation Via Composer: $ composer require nepada/email-address Usage This package provides two implementations of email

null 5 Jan 1, 2022
Magento 2 Email Catcher or Email Logger Module.

Magento 2 Module Experius email catcher / - logger

Experius 49 Dec 16, 2021
SendPortal - Open-source self-hosted email marketing, subscriber and list management, email campaigns and more

SendPortal includes subscriber and list management, email campaigns, message tracking, reports and multiple workspaces/domains in a modern, flexible and scalable application.

Mettle 1.1k Sep 27, 2022
Cross-language email validation. Backed by a database of over 38 000 throwable email domains.

Cross-language temporary (disposable/throwaway) email detection library. Covers 38038+ fake email providers.

Francois-Guillaume Ribreau 1.4k Sep 24, 2022
A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address

A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address Mail spf checker A Laravel package to c

Dieter Coopman 102 Sep 20, 2022
An AngularJS / Laravel app - Keyword Based Email forwarder | read/write emails through IMAP

@MailTree Simple mail forwarder. Based on the specific email body/subject keywords forward mails to the list of predefined users. Install Imap Install

Dren Kajmakchi 4 Aug 21, 2018
The classic email sending library for PHP

PHPMailer – A full-featured email creation and transfer class for PHP Features Probably the world's most popular code for sending email from PHP! Used

PHPMailer 18.7k Sep 30, 2022
PHP library for parsing plain text email content.

EmailReplyParser EmailReplyParser is a PHP library for parsing plain text email content, based on GitHub's email_reply_parser library written in Ruby.

William Durand 600 Sep 4, 2022
Send email across all platforms using one interface

Send email across all platforms using one interface. Table Of Content Requirements Installation Providers AmazonSES Mailgun Mailjet Mandrill Postmark

Omnimail 328 Sep 15, 2022
Small PHP library to valid email addresses using a number of methods.

Email Validator Small PHP library to valid email addresses using a number of methods. Features Validates email address Checks for example domains (e.g

James Jackson 154 Sep 27, 2022
Library for using online Email providers

Stampie Stampie have been moved to the "Flint" organization in order to get a better collaborative flow. Stampie is a simple API Wrapper for different

Henrik Bjørnskov 32 Oct 7, 2020
Library for using online Email providers

Stampie Stampie is a simple API Wrapper for different email providers such as Postmark and SendGrid. It is very easy to use and to integrate into your

Stampie 286 Sep 1, 2022
Mail sending module for Mezzio and Laminas MVC with support for file attachment and template email composition

This module provides an easy and flexible way to send emails from Mezzio and Laminas MVC applications (formerly known as Zend Expressive and Zend MVC). It allows you to pre-configure emails and transports, and then send those emails at runtime.

null 82 Jan 16, 2022
Omnisend: Ecommerce Email Marketing and SMS Platform

Omnisend Omnisend: Ecommerce Email Marketing and SMS Platform Version v1.x Support all PHP Version >=5.6 v2.x Support all PHP Version >=7.0 Installati

Hung Nguyen 3 Jan 6, 2022
Sending Email via Microsoft Exchange Web Services made Easy!

Send Mail via Exchange Web Services! Sending Email via Microsoft Exchange Web Services (EWS) made easy! Installation Install via Composer composer req

Raju Rayhan 19 Jul 19, 2022
Mailcoach is a self-hosted email list manager - in a modern jacket.

Welcome to Mailcoach Mailcoach is a self-hosted email list manager - in a modern jacket. It features: Subscribers and lists management Subscribe, doub

Spatie 3 Jan 31, 2022
EMAIL, PASSWORD AND USERNAME GENERATOR

Email-Generator EMAIL, PASSWORD AND USERNAME GENERATOR Install on desktop : Install XAMPP Added environment variable system path => C:\xampp\php downl

Alex 2 Jan 8, 2022
📧 Handy email creation and transfer library for PHP with both text and MIME-compliant support.

?? Handy email creation and transfer library for PHP with both text and MIME-compliant support.

Nette Foundation 393 Sep 22, 2022