napoleon/omnismtp-sendgrid

Sendgrid driver for SMTP processing library

0.2 2020-08-25 08:14 UTC

This package is auto-updated.

Last update: 2024-04-26 10:40:57 UTC


README

Build Status

Installation

composer require napoleon/omnismtp-sendgrid

How to use

Single Recipients

<?php

$key = 'api-key';

$sendgrid = \OmniSmtp\OmniSmtp::create(\Napoleon\OmniSmtp\SendGrid::class, $key);

$sendgrid->setSubject('The Mail Subject')
    ->setFrom('napoleon@example.com')
    ->setRecipients('testemail1@example.com')
    ->setContent('<p>Hello From SendGrid OmniMail</p>')
    ->send();

Multiple Recipients

<?php

$key = 'api-key';

$sendgrid = \OmniSmtp\OmniSmtp::create(\Napoleon\OmniSmtp\SendGrid::class, $key);

$sendgrid->setSubject('The Mail Subject')
    ->setFrom('napoleon@example.com')
    ->setRecipients('testemail1@example.com', 'testemail2@example.com')
    ->setContent('<p>Hello From SendGrid OmniMail</p>')
    ->send();