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

Retrieve MessageID from response #24

Open
warksit opened this issue Nov 27, 2019 · 3 comments
Open

Retrieve MessageID from response #24

warksit opened this issue Nov 27, 2019 · 3 comments

Comments

@warksit
Copy link

warksit commented Nov 27, 2019

Is there a way to do this currently? Other packages such as https://github.com/craigpaul/laravel-postmark add this as a header like so when the message is sent:

  $message->getHeaders()->addTextHeader(
            'X-PM-Message-Id',
            $this->getMessageId($response)
        );

I'd like to use this package as it is the Laravel recommendation but require this functionality. Would you be interested in a Pull Request?

@dejury
Copy link

dejury commented Jun 29, 2021

Any news on this one? I would like to retrieve the Postmark ID after sending the mail, can't figure out how!

@warksit
Copy link
Author

warksit commented Jun 29, 2021

The way I acheieved this is listen for the Illuminate\Mail\Events\MessageSent Event and in the listener you can retrieve the ID

public function handle(MessageSent $email)
{
    $email->message->getHeaders()->get('X-PM-Message-Id')->getValue()
}

@dejury
Copy link

dejury commented Jun 29, 2021

The way I acheieved this is listen for the Illuminate\Mail\Events\MessageSent Event and in the listener you can retrieve the ID

public function handle(MessageSent $email)
{
    $email->message->getHeaders()->get('X-PM-Message-Id')->getValue()
}

I doubt this works in the current version. Created a PR to support this.

balvig added a commit that referenced this issue Sep 5, 2022
Pulls in changes from #46 (thank you @dejury, and sorry for the wait! 🙇 ) and adds a test for it.

Closes #46 #24 (had to rebuild the PR after the repo move).
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

No branches or pull requests

2 participants