PHP code example of camuthig / courier-mailjet

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

    

camuthig / courier-mailjet example snippets




amuthig\Courier\Mailjet\MailjetCourier;
use Mailjet\Client;
use PhpEmail\EmailBuilder;
use PhpEmail\Content\SimpleContent;

$client = new Client(getenv('MAILJET_API_KEY'), getenv('MAILJET_API_SECRET'));
$courier = new MailjetCourier($client);

$email = EmailBuilder::email()
            ->to('[email protected]')
            ->from('[email protected]')
            ->withSubject('Great Email!')
            ->withContent(SimpleContent::text('Text')->addHtml('HTML'))
            ->build();

$courier->deliver($email);