Mail SPF Checker for Laravel

Packages

September 1st, 2022

Mail SPF Checker for Laravel

The Laravel Mail SPF Checker is a package to check if you can send an e-mail through a given mail server in the name of a given e-mail address:

When sending in the name of a domain without using the legitimate mail server 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 provides a checker that you can use in your app to ensure you have a correct SPF record:

1$mailSpfChecker->canISendAs("hello@dietse.dev"); // bool
2 
3// If you cannot send mail correctly, this will output the needed SPF record:
4 
5if (! $mailSpfChecker->canISendAs("hello@dietse.dev")) {
6 // Generate a txt-record with a name of dietse.dev
7 // and the value v=spf1 ip4:#.#.#.# -all
8 echo $mailSpfChecker->howCanISendAs("hello@dietse.be");
9}

You can also check using a given mail server:

1$mailSpfChecker
2 ->using('SMTP.mandrill.com')
3 ->canISendAs("hello@dietse.dev");

You can get started with this package by checking out the Mail SFP Checker on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.