Skip to content

Conversation

@christophrumpel
Copy link
Contributor

@christophrumpel christophrumpel commented Dec 29, 2020

This PR adds the possibility to set a Postmark message stream id when defining a Postmark mailer like:

'postmark' => [
    'transport' => 'postmark',
    'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'), // this is new
],

(config/mail.php)

Disclaimer:
In Postmark you can define servers which are like accounts and they have a custom API token, which you can already set in Laravel when using the postmark mailer.

'postmark' => [
    'token' => env('POSTMARK_TOKEN'),
],

(Example from Laravel docs https://laravel.com/docs/master/mail#postmark-driver)

But besides servers, you also have message streams with Postmark Servers. They can be used to separate transactional from broadcast emails for better deliverability. They do not have separated tokens, so you have to set a header in order to define the used stream. (https://github.com/wildbit/swiftmailer-postmark#5-setting-the-message-stream)

Current working solutions:

Currently, you can only set such a header on a per mail base in a mailable like:

public function build()
{
    $this->view('emails.orders.shipped');

    $this->withSwiftMessage(function ($message) {
        $message->getHeaders()
                ->addTextHeader('Custom-Header', 'HeaderValue');
    });
}

With this PR you can also define a specific message stream on a per mailer basis which also lets you create different mailers which apps like Laravel Mailcoach supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants