D
D
D44k2019-12-17 18:42:38
Email
D44k, 2019-12-17 18:42:38

How to catch message_id from Mailgun?

There is Laravel, in which letters are sent through Mailgun, there is a need to write the message_id returned by mailgun to the database when sending a letter. How to catch this same message_id if letters are sent somewhere under the hood of the mailgun itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vism, 2019-12-18
@D44k

when sending a letter, you yourself add it to user-variables

$this->withSwiftMessage(function ($message) {
            $message->getHeaders()
                ->addTextHeader("X-Mailgun-Variables", json_encode([
                    MailTrackingService::KEY__CUSTOMER_EMAILS__ID => $this->mixins[MailTrackingService::KEY__CUSTOMER_EMAILS__ID],
                    MailTrackingService::KEY__ENVIRONMENT => \App::environment(),
                ]));
        });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question