PHPackages                             dietercoopman/mailspfchecker - 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. dietercoopman/mailspfchecker

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

dietercoopman/mailspfchecker
============================

A package to check if you can send e-mail through a given mailserver in name of a given e-mail address

v1.0.7(1y ago)1606.2k↑22.2%9[2 PRs](https://github.com/dietercoopman/mailspfchecker/pulls)2MITPHPPHP ^8.0|^8.1CI passing

Since Aug 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dietercoopman/mailspfchecker)[ Packagist](https://packagist.org/packages/dietercoopman/mailspfchecker)[ Docs](https://github.com/dietercoopman/mailspfchecker)[ RSS](/packages/dietercoopman-mailspfchecker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (12)Versions (11)Used By (2)

[![showsql](https://camo.githubusercontent.com/a68bdc414c1c2f6c9fc6fea19fe5ec1d2b81acd215ad50a874b3ac33e3ec84d8/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f6d61696c737066636865636b65722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d646965746572636f6f706d616e2532466d61696c737066636865636b6572267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b4c61726176656c2b7061636b6167652b746f2b636865636b2b69662b796f75722b6170706c69636174696f6e2b63616e2b73656e642b652d6d61696c2b696e2b6e616d652b6f662b612b676976656e2b616464726573732e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/a68bdc414c1c2f6c9fc6fea19fe5ec1d2b81acd215ad50a874b3ac33e3ec84d8/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f6d61696c737066636865636b65722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d646965746572636f6f706d616e2532466d61696c737066636865636b6572267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b4c61726176656c2b7061636b6167652b746f2b636865636b2b69662b796f75722b6170706c69636174696f6e2b63616e2b73656e642b652d6d61696c2b696e2b6e616d652b6f662b612b676976656e2b616464726573732e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2b61bd913e69a68abcd6473a6ce1a474eaacb7a629cb0bbd7030fa0ed9e256be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646965746572636f6f706d616e2f6d61696c737066636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dietercoopman/mailspfchecker)[![Total Downloads](https://camo.githubusercontent.com/6246ff4e5b85b850422766f8eec5d2d7772a40120c99667216a11cffdaecca2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646965746572636f6f706d616e2f6d61696c737066636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dietercoopman/mailspfchecker)

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
================

[](#mail-spf-checker)

A Laravel package to check if your application can send e-mail in name of a given address.

Use case
--------

[](#use-case)

Most of the web applications are sending mails. Mostly through a local mail server or an external mailing service.
When sending in name of a domain without using the legitimate mailserver of the domain it can get tricky.
Most of the time your mail ends up in a spam folder. This can be solved by configuring a correct SPF record for the domain you are sending with. This package gives you the possibility to check if you can send with a given from address using the mailserver specified in your mail config or a given mailserver. It also gives the possibility to retrieve a dns txt record to configure your dns.

Compatibility
-------------

[](#compatibility)

This package can be installed in Laravel 6,7,8,9 and 10

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

[](#installation)

```
composer require dietercoopman/mailspfchecker
```

Examples
--------

[](#examples)

### Using the mailserver used by your application

[](#using-the-mailserver-used-by-your-application)

```
    if ($mailSpfChecker->canISendAs("hello@dietse.dev")) {
        // the happy path
    } else {
        // you can not send e-mail in name of hello@dietse.dev, but I can tell you what to do
        echo $mailSpfChecker->howCanISendAs("hello@dietse.be");
        // Generate a txt-record with a name of dietse.dev and the value v=spf1 ip4:#.#.#.# -all
    }
```

### Using a given mailserver

[](#using-a-given-mailserver)

```
    if ($mailSpfChecker->using('smtp.mandrill.com')->canISendAs("hello@dietse.dev")) {
        // the happy path
    } else {
        // you can not send e-mail in name of hello@dietse.dev, but I can tell you what to do
        echo $mailSpfChecker->using('smtp.mandrill.com')->howCanISendAs("hello@dietse.be");
        // Generate a txt-record with a name of dietse.dev and the value v=spf1 ip4:spf.mandrill.com -all
    }
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Dieter Coopman](https://github.com/dietercoopman)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance43

Moderate activity, may be stable

Popularity40

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 57.8% 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 ~133 days

Recently: every ~225 days

Total

8

Last Release

450d ago

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^7.4|^8.0|^8.1

v1.0.4PHP ^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a5498402f8114208ae9befe10cb82ea43e33e256ce22c96ff0ec97cb6c87fc5?d=identicon)[dietercoopman](/maintainers/dietercoopman)

---

Top Contributors

[![dietercoopman](https://avatars.githubusercontent.com/u/4672752?v=4)](https://github.com/dietercoopman "dietercoopman (37 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (16 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (1 commits)")

---

Tags

dnslaravelmailspflaraveldietercoopmanmailspfchecker

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/dietercoopman-mailspfchecker/health.svg)

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[spatie/laravel-notification-log

Log notifications sent by your Laravel app

207902.8k](/packages/spatie-laravel-notification-log)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)[backstage/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24157.5k5](/packages/backstage-laravel-mails)

PHPackages © 2026

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