mailjet / mailjetBundle

Symfony bundle for Mailjet API V3
https://mailjet.github.io/mailjetBundle/
MIT License
34 stars 36 forks source link

Use online template from Passport #1

Closed Colmea closed 7 years ago

Colmea commented 7 years ago

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.

Zhivko-Mailjet commented 7 years ago

@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.

Nightbr commented 7 years ago

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 commented 7 years ago

@Colmea are these answers resolved your issue?

Colmea commented 7 years ago

Yep, thanks for your fast answers !