PHP code example of wsw / email

1. Go to this page and download the library: Download wsw/email 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/ */

    

wsw / email example snippets




use WSW\Email\Email;

try {
    $email = new Email('[email protected]');

    echo $email->getEmail();    // (string) [email protected]
    echo $email->getUsername(); // (string) ronaldo
    echo $email->getHostname(); // (string) whera.com.br
    print_r($email->getMx());   // (array) list mx records

    echo $email; // (string) [email protected]

} catch (\InvalidArgumentException $e) {
    echo $e->getMessage();
}