-
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,
-
-
Save dammyammy/548dccc71acb1f7d7d38979cbff7e6fd 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