Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Make it possible to set Postmark Message Stream ID #35755

Merged
merged 1 commit into from Dec 29, 2020
Merged

[8.x] Make it possible to set Postmark Message Stream ID #35755

merged 1 commit into from Dec 29, 2020

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.

None yet

2 participants