Skip to content

toastnz/sendgrid-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SilverStripe SendGrid Mailer

Simple mailer module that uses SendGrid API to send emails.

Requirements

  • silverstripe/cms ^4.3.x
  • silverstripe/framework ^4.3.x
  • sendgrid/sendgrid ^7.3

Installation

composer require toastnz/sendgrid-mailer

Configuration

Add the following to your app.yml:

Toast\SSSendGrid\SendGridMailer:
  api_key: 'YOUR_SENDGRID_API_KEY'

Usage

Simply use the Email class provided by SilverStripe framework:

$email = new SilverStripe\Control\Email\Email();
$email->setFrom('[email protected]', 'John Doe');
$email->setTo('[email protected]', 'Jane Doe');
$email->setSubject('This is a test email');
$email->setBody('Hello there, this was sent using SendGrid');
$email->addAttachment('path/to/file.pdf', 'document.pdf');
$email->send();

About

SilverStripe SendGrid Mailer

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages