PHP code example of dietercoopman / mailspfchecker

1. Go to this page and download the library: Download dietercoopman/mailspfchecker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dietercoopman / mailspfchecker example snippets

 

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

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