New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

tparcina/qsendgridbundle

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tparcina/qsendgridbundle

Symfony bundle implementation of QSendgrid mailer service

symfony-bundle
Source
Packagist
Version
1.1.1
Version published
Total downloads
4
Maintainers
1
Created
Source

QSendgridBundle

Symfony bundle implementation of QSendgrid mailer service.

Prerequisites

You will need to provide:

  • Sendgrid API key, which can be created in Sendgrid user interface
  • No Reply email address

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

Keywords

qsendgrid bundle

FAQs

Package last updated on 16 Sep 2021

Related posts