PHPackages                             vulcandigital/silverstripe-sendgrid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. vulcandigital/silverstripe-sendgrid

ActiveSilverstripe-vendormodule[Mail &amp; Notifications](/categories/mail)

vulcandigital/silverstripe-sendgrid
===================================

A module to assist developers in sending template emails via SendGrid

1.3.1(8y ago)44255[1 issues](https://github.com/vulcandigital/silverstripe-sendgrid/issues)BSD-3-ClausePHP

Since Feb 1Pushed 8y ago2 watchersCompare

[ Source](https://github.com/vulcandigital/silverstripe-sendgrid)[ Packagist](https://packagist.org/packages/vulcandigital/silverstripe-sendgrid)[ RSS](/packages/vulcandigital-silverstripe-sendgrid/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (4)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/058db0f297a9be3a5023f89e7f2cea1496cd0491c81e5e3a3b807ea7e92d4b1a/68747470733a2f2f7472617669732d63692e6f72672f76756c63616e6469676974616c2f73696c7665727374726970652d73656e64677269642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vulcandigital/silverstripe-sendgrid) [![codecov](https://camo.githubusercontent.com/3cb982602e8da83539af3c95464259d1e13d208e423f82f48afa8260d2acc79e/68747470733a2f2f636f6465636f762e696f2f67682f76756c63616e6469676974616c2f73696c7665727374726970652d73656e64677269642f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/vulcandigital/silverstripe-sendgrid) [![Latest Stable Version](https://camo.githubusercontent.com/c99c21685704c877e0022269850817e9be7fbd833ae959388ee0abae6d96daa4/68747470733a2f2f706f7365722e707567782e6f72672f76756c63616e6469676974616c2f73696c7665727374726970652d73656e64677269642f762f737461626c65)](https://packagist.org/packages/vulcandigital/silverstripe-sendgrid) [![Total Downloads](https://camo.githubusercontent.com/f503ddc63dc2a8f6c528fbcb6f23be5662baac4210da6e324987c48150c2efb9/68747470733a2f2f706f7365722e707567782e6f72672f76756c63616e6469676974616c2f73696c7665727374726970652d73656e64677269642f646f776e6c6f616473)](https://packagist.org/packages/vulcandigital/silverstripe-sendgrid) [![License](https://camo.githubusercontent.com/7114c9d649faccccd96697bfd26517b79b75dc77380d4d9ecca65ec0040390f4/68747470733a2f2f706f7365722e707567782e6f72672f76756c63616e6469676974616c2f73696c7665727374726970652d73656e64677269642f6c6963656e7365)](https://packagist.org/packages/vulcandigital/silverstripe-sendgrid)

silverstripe-sendgrid
---------------------

[](#silverstripe-sendgrid)

A module to assist developers in sending template emails via SendGrid

Requirements
------------

[](#requirements)

- silverstripe/framework: ^4.0

Installation
------------

[](#installation)

```
composer require vulcandigital/silverstripe-sendgrid
```

Configuration
-------------

[](#configuration)

**mysite/\_config/sendgrid.yml:**

```
Vulcan\SendGrid\SendGrid:
  api_key: 'REPLACE-WITH-YOUR-API-KEY'
```

Usage
-----

[](#usage)

```
$sendGrid = \Vulcan\SendGrid\SendGrid::create();
$sendGrid->setSubject("We have a sale for you!");
$sendGrid->setFrom('marketing@example.com');
$sendGrid->setFromName('My Site');
$sendGrid->setReplyTo('sales@example.com');
$sendGrid->addRecipient('reece@vulcandigital.co.nz', 'Reece Alexander', [
    ':salutation' => 'Mr',
    ':button_link' => 'https://example.com/store/offer?id=aASdGdjnklashewjk12321hjkasd213'
]);
$sendGrid->setBody("We thought you'd like this awesome t-shirt!");
$sendGrid->setTemplateId('your-template-id');
$sendGrid->addAttachment(Image::get()->first());
$sendGrid->send();
```

You can add as many recipients as you want.

Substitutions &amp; Custom Arguments
------------------------------------

[](#substitutions--custom-arguments)

Substitutions and custom arguments are practically the same thing, the only difference is that custom arguments are applied globally regardless of the recipient where substitutions are variable replacements that can differ per recipient.

> Substitutions will always override any custom argument

### Substitutions

[](#substitutions)

Substitutions are variables that can be replaced per recipient

```
$sendGrid->addRecipient('john@doe.com', 'John Doe', [
    ':salutation' => 'Mr',
    ':first_name' => 'John',
    ':last_name' => 'Doe'
]);
$sendGrid->addRecipient('jane@doe.com', 'Jane Doe', [
    ':salutation' => 'Mrs',
    ':first_name' => 'Jane',
    ':last_name' => 'Doe'
]);
```

### Custom Arguments

[](#custom-arguments)

Custom arguments are applied globally across all recipients unless a substitution has overridden it

```
$sendGrid->addCustomArg(':year', DBDatetime::now()->Year());
```

### Attachments

[](#attachments)

You can add as many attachments as you want totalling up to 30 MB. The attachment must be a `File` object or a subclass of it such as itself or `Image`.

```
$file = Image::get()->first();
$sendGrid->addAttachment($file, $filename = null, $forcePublish = false);
```

or you can use an absolute path to a file instead:

```
$sendgrid->addAttachment('/public_html/path/to/image.png'));
$sendgrid->addAttachment(Controller::join_links(Director::baseFolder(), '/path/to/image2.png'));
```

If you provide `$filename`, make sure you provide the correct extension as well to prevent any errors

If the provided file is a `File` object and `$forcePublish` is set to `true` *and* the `File` you have provided has not been published, it will be forcibly published.

### Scheduling

[](#scheduling)

You can schedule emails to be sent at a later date:

```
$sendGrid->setScheduleTo(DBDatetime::now()->getTimestamp() + 3600); // Schedule to send in 1 hour
```

> **Important:** Ensure that you have specified your correct timezone in your SendGrid account's settings, otherwise this may have unexpected results.
>
> Your database timezone should also match the timezone you have specified in your account. See [Core Environment Variables](https://docs.silverstripe.org/en/4/getting_started/environment_management/#core-environment-variables) for information on how to modify the timezone used by your database.
>
> It is always advised when dealing with dates and times in SilverStripe to use the functionality it has provided you as shown in the example above.

### Sandbox Mode

[](#sandbox-mode)

```
$sendGrid->setSandboxMode(true);
```

If everything is OK, $sendGrid-&gt;send() will return true otherwise an error will be thrown.

License
-------

[](#license)

[BSD-3-Clause](LICENSE.md) - [Vulcan Digital Ltd](https://vulcandigital.co.nz)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~23 days

Total

5

Last Release

2931d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79352f13e05702b6ba2a9e27508d7cbd72e902342ff4e6608861b40a7cab5644?d=identicon)[vulcandigital](/maintainers/vulcandigital)

---

Top Contributors

[![zanderwar](https://avatars.githubusercontent.com/u/13566916?v=4)](https://github.com/zanderwar "zanderwar (19 commits)")

---

Tags

sendgridsilverstripe-4

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/vulcandigital-silverstripe-sendgrid/health.svg)

```
[![Health](https://phpackages.com/badges/vulcandigital-silverstripe-sendgrid/health.svg)](https://phpackages.com/packages/vulcandigital-silverstripe-sendgrid)
```

###  Alternatives

[swiftmade/laravel-sendgrid-notification-channel

Laravel Notification Channel for Sengrid.com

26287.7k](/packages/swiftmade-laravel-sendgrid-notification-channel)[silverstripe/mimevalidator

Checks uploaded file content roughly matches a known MIME type for the file extension.

102.0M9](/packages/silverstripe-mimevalidator)[iandenh/cakephp-sendgrid

SendgridEmail plugin for CakePHP

16123.4k](/packages/iandenh-cakephp-sendgrid)[bryglen/yii2-sendgrid

Sendgrid Mailer for Yii 2

1353.5k](/packages/bryglen-yii2-sendgrid)[friendsofsilverstripe/backendmessages

DRY way to create message boxes in SilverStripe backend.

1015.4k2](/packages/friendsofsilverstripe-backendmessages)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
