PHP code example of kardasz / swiftmailer-transport-sendgrid
1. Go to this page and download the library: Download kardasz/swiftmailer-transport-sendgrid 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/ */
kardasz / swiftmailer-transport-sendgrid example snippets
use Kardasz\Swiftmailer\Transport\SendGridTransport;
use SendGrid;
use Swift_Events_SimpleEventDispatcher;
use Swift_Mailer;
use Swift_Message;
ort = new SendGridTransport($sendgrid);
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['[email protected]' => 'John Doe'])
->setTo(['[email protected]', '[email protected]' => 'A name'])
->setBody('Here is the message itself')
;
// Send the message
$result = $mailer->send($message);