How to send email using SendGrid template with php api?

I recently created a template in my SendGrid account that I would like to use in my php application.

I am currently sending emails using this account, but I need to encode html directly in my application, which does not provide the necessary flexibility.

I could not find a method in the API to select the template I want to use and replace the variables ....

Any idea?

thanks

+5
source share
2 answers

After digging through GitHub, I found this piece of code that works for me ... Hope this helps you.

$mail->setTemplateId("xxxxxxxxxxxxxxxxxxxx");
// Put your template ID in from the web console after you create a template
+4
source

Source: https://habr.com/ru/post/1612761/


All Articles