mailjetBundle icon indicating copy to clipboard operation
mailjetBundle copied to clipboard

Use online template from Passport

Open Colmea opened this issue 9 years ago • 4 comments

Hi Mailjet team,

I would like to know if there's a way to use this bundle to send online template emails from Mailjet Passport ? I don't see anything in the doc regarding Passport.

Colmea avatar Jul 14 '17 14:07 Colmea

@Colmea

Correct me if I'm wrong, but from what I understand you would like to create a template through Passport and send it through the bundle. This is indeed possible, using the ID of the template. In the API call, you add the property 'MJ-TemplateID' => $ID. See here: https://dev.mailjet.com/guides/?php#use-the-template-in-send-api

Bundle documentation can be found here: https://mailjet.github.io/mailjetBundle/usage/#retrieve-mailjet-client-object-to-make-custom-mailjet-api-v3-requests

Hope this helps.

Zhivko-Mailjet avatar Jul 14 '17 14:07 Zhivko-Mailjet

Hi, @Zhivko-Mailjet yes you're right or you can do it with SwiftMailer and custom headers:

//Configure Headers
$headers = $message->getHeaders();
// Mailjet header
$headers->addTextHeader('X-MJ-TemplateID', PUT_YOUR_TEMPLATE_ID);

// send email
$this->get('mailer')->send($message);

Documentation here:

Nightbr avatar Jul 14 '17 17:07 Nightbr

@Colmea are these answers resolved your issue?

Nightbr avatar Jul 17 '17 13:07 Nightbr

Yep, thanks for your fast answers !

Colmea avatar Jul 17 '17 14:07 Colmea