Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
/ courier-sparkpost Public archive

An adapter to use Sparkpost with Courier

License

Notifications You must be signed in to change notification settings

quartzy/courier-sparkpost

Repository files navigation

SparkPost Courier

Latest Version on Packagist Total Downloads Software License Build Status Coverage Status Style Status Scrutinizer Code Quality

A courier implementation for SparkPost.

See documentation for full details.

Install

Via Composer

composer require quartzy/courier-sparkpost

You will also need to install a php-http implementation library as defined in the SparkPost docs.

Usage

<?php

use Courier\SparkPost\SparkPostCourier;
use GuzzleHttp\Client;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
use PhpEmail\Content\TemplatedContent;
use PhpEmail\EmailBuilder;
use SparkPost\SparkPost;

new Client();

$courier = new SparkPostCourier(
    new SparkPost(new GuzzleAdapter(new Client()), ['key'=>'YOUR_API_KEY'])
);

$email = EmailBuilder::email()
    ->from('[email protected]')
    ->to('[email protected]')
    ->replyTo('[email protected]', 'Your Sales Rep')
    ->withSubject('Welcome!')
    ->withContent(new TemplatedContent('my_email', ['testKey' => 'value']))
    ->build();

$courier->deliver($email);

For details on building the email objects, see Php Email.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The Apache License, v2.0. Please see License File for more information.

About

An adapter to use Sparkpost with Courier

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages