adt/spark-post-api-mailer

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

Sending emails through SparkPost API.

v1.8 2023-06-28 13:14 UTC

This package is auto-updated.

Last update: 2024-10-28 16:31:29 UTC


README

Installation

  1. composer

    composer require adt/spark-post-api-mailer
  2. config.neon

    extensions:
        sparkPostApiMailer: ADT\SparkPostApiMailer\DI\SparkPostApiMailerExtension
    
    sparkPostApiMailer:
    	authToken: <YOUR TOKEN>

Usage

  1. standalone

    config.neon

    services:
        nette.mailer:
            class: \ADT\SparkPostApiMailer\Services\SparkPostApiMailerService

    MailComponent.php

    function __construct(\Nette\Mail\IMailer $mailer) {
        $this->mailer = $mailer;
    }
    
    function sendMail(\Nette\Mail\Message $mail) {
        $this->mailer->send($mail);
    }
  2. with adt/single-recipient-mailer

    Mailer.php

    class Mailer extends \ADT\Mail\SingleRecipientMailer {
        public function __construct(
            array $options,
            \ADT\SparkPostApiMailer\Services\SparkPostApiMailerService $apiMailer
        ) {
            parent::__construct($options);
            $this->mailer = $apiMailer;
        }
    }