[英]How to send an email using a SendGrid template with php api?
我最近在我的 SendGrid 帳戶中創建了一個模板,我想在我的 php 應用程序中使用它。
我目前正在使用該帳戶發送電子郵件,但我必須在我的應用程序中對 html 進行編碼,這不能提供我需要的靈活性。
我在 API 中找不到一種方法來選擇我想要使用的模板並替換變量....
任何的想法?
謝謝
在深入研究 GitHub 后,我發現這個代碼片段對我有用......我希望它對你有幫助。 要在 v3 中使用模板,代碼如下:
$mail->setTemplateId("xxxxxxxxxxxxxxxxxxxx");
// Put your template ID in from the web console after you create a template
如果您使用的是 SendGrid PHP 庫: https : //github.com/sendgrid/sendgrid-php/blob/main/USE_CASES.md#transactional-templates
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.