【问题标题】:How to send an email using a SendGrid template with php api?如何使用带有 php api 的 SendGrid 模板发送电子邮件?
【发布时间】:2015-10-22 13:41:07
【问题描述】:

我最近在我的 SendGrid 帐户中创建了一个模板,我想在我的 php 应用程序中使用它。

我目前正在使用该帐户发送电子邮件,但我必须在我的应用程序中直接编写 html 代码,这不能提供我需要的灵活性。

我在 API 中找不到方法来选择我想使用的模板并替换变量....

有什么想法吗?

谢谢

【问题讨论】:

标签: php sendgrid


【解决方案1】:

在通过 GitHub 挖掘后,我发现这段代码 sn-p 对我有用……希望它对你有所帮助。 要在 v3 中使用模板,代码如下:

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

【讨论】:

  • 确认它在 2020 年仍然有效 :) 并且他们的文档仍然很糟糕 :(
【解决方案2】:
猜你喜欢
  • 2016-07-12
  • 2011-04-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多