-
Install the Postmark Swiftmailer
composer require wildbit/swiftmailer-postmark
-
Add the following variables to your
.env
file.MAIL_DRIVER=postmark POSTMARK_KEY=<key>
-
Add the following line to
config/services.php
'postmark' => [ 'key' => env('POSTMARK_KEY') ],
-
Replace Laravel's
MailServiceProvider
insideconfig/app.php
with the providedPostmarkServiceProvider.php
.// Illuminate\Mail\MailServiceProvider::class, App\Providers\PostmarkServiceProvider::class,
Last active
June 1, 2018 14:15
-
-
Save tylerodonnell/e91f7d58293ba037c22d933f8652d022 to your computer and use it in GitHub Desktop.
How to use Postmark SwiftMailer inside Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Postmark\Transport; | |
use Illuminate\Mail\MailServiceProvider; | |
class PostmarkServiceProvider extends MailServiceProvider | |
{ | |
/** | |
* Extended register the Swift Transport instance. | |
* | |
* @return void | |
*/ | |
protected function registerSwiftTransport() | |
{ | |
parent::registerSwiftTransport(); | |
$this->app['swift.transport']->extend('postmark', function($app) { | |
return new Transport( | |
config('services.postmark.key') | |
); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment