PHP code example of dalysie / mailhuset

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

    

dalysie / mailhuset example snippets



= new \Mailhuset\Mailhuset('mh_live_…');

$result = $mh->emails->send([
    'from'    => '[email protected]',
    'to'      => '[email protected]',
    'subject' => 'Verify your email',
    'html'    => '<p>Welcome</p>',
]);

echo $result['id'], ' ', $result['status'], PHP_EOL;

try {
    $mh->emails->send([...]);
} catch (\Mailhuset\MailhusetException $e) {
    error_log("mailhuset {$e->status}: {$e->getMessage()}");
}

$mh = new \Mailhuset\Mailhuset('mh_live_…', [
    'baseUrl' => 'https://api.mailhuset.com/v1',
]);