PHP code example of vs-point / symfony-mailjet-mailer

1. Go to this page and download the library: Download vs-point/symfony-mailjet-mailer 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/ */

    

vs-point / symfony-mailjet-mailer example snippets


$dsn = 'mailjet://{public key}:{private key}@api.mailjet.com';

$transport = Transport::fromDsn($dsn);
$mailer = new Mailer($transport);
$email = (new Email())
            ->from('[email protected]')
            ->to('[email protected]')
            //->cc('[email protected]')
            //->bcc('[email protected]')
            //->replyTo('[email protected]')
            //->priority(Email::PRIORITY_HIGH)
            ->subject('Time for Symfony Mailer!')
            ->text('Sending emails is fun again!')
            ->html('<p>See Twig integration for better HTML integration!</p>');
$mailer->send($email);

$dsn = 'mailjet://{public key}:{private key}@api.mailjet.com';

$transport = Transport::fromDsn($dsn);
$mailer = new Mailer($transport);
$email = (new MailjetTemplateEmail(123456789,['variable'=>'value']))
            ->from('[email protected]');
$mailer->send($email);