q-alliance/qsendgridbundle

There is no license information available for the latest version (1.0.4) of this package.

Symfony bundle implementation of QSendgrid mailer service

Installs: 179

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 5

Forks: 1

Type:symfony-bundle

1.0.4 2020-07-25 11:41 UTC

This package is not auto-updated.

Last update: 2021-10-02 17:32:38 UTC


README

Symfony bundle implementation of QSendgrid mailer service.

Prerequisites

You will need to provide:

Key example: SG.QDzWlz_gShWMVi8svP...

Installing

Install QSendgridBundle with composer:

composer require q-alliance/qsendgridbundle

Setup

Update AppKernel.php

$bundles = [
	...
    new QAlliance\QSendgridBundle\QAllianceQSendgridBundle(),
];

Update config.yml

# QSendgrid Configuration
q_alliance_q_sendgrid:
    no_reply_email: NO_REPLY_EMAIL
    sendgrid_api_key: SENDGRID_API_KEY

Basic usage

Get QSendgrid mailer service from controller and send simple email:

$qs = $this->get('qalliance.qsendgrid');

$result = $qs->send('to@example.com', 'My Subject', '<h1>This is a QSendgrid test email.</h1>');

Sending html email with attachments:

$attachmentUrls = [
	'./assets/attachments/sample1.jpg',
	'./assets/attachments/sample2.jpg'
];


$qs = $this->get('qalliance.qsendgrid');

$result = $qs->send('to@example.com', 'My Subject', '<h1>This is a QSendgrid test email with attachments.</h1>', $attachmentUrls);

Add fromName as last parameter (optional):

$qs = $this->get('qalliance.qsendgrid');

$result = $qs->send('to@example.com', 'My Subject', '<h1>This is a QSendgrid test email.</h1>', null, 'From Name');

Sending email with html and plain text content:

$qs = $this->get('qalliance.qsendgrid');

$result = $qs->sendWithTextPlain('to@example.com', 'My Subject', '<h1>This is a QSendgrid test email with plain text.</h1>', 'This is a QSendgrid test email with plain text', null, 'From Name');

Authors