【问题标题】:How to send non-transactional emails automatically from website如何从网站自动发送非交易电子邮件
【发布时间】:2021-12-27 03:39:57
【问题描述】:

我曾使用 SendGrid 或 Mandrill 从网站发送交易电子邮件,但我想发送自动电子邮件,以便在网站添加符合其条件的内容时通知订阅者。我想使用 cron 作业来检查我的 mysql 数据库,看看是否有新的“匹配”并发送电子邮件通知客户。除了实际发送电子邮件部分之外,我知道如何编写脚本来完成所有这些工作,因为我不想使用 PHP 邮件功能,以防电子邮件量太大而 SendGrid 或 Mandrill 仅用于事务性电子邮件。谢谢!

【问题讨论】:

  • 使用您使用 cron 作业的脚本中的 SendGrid API。
  • 你可以使用 phpmailer 或 swift mailer。
  • 我查了definition for transactional email,我不明白为什么这个用例不属于这个类别。您的提供商是否有明确禁止它们的使用条款或其他内容?

标签: php mysql email


【解决方案1】:

Mandrill API(实际上是 mailchimp)为您提供了端点来发送您自己的 html 内容,或者使用您可以通过其 API 提供变量的模板。 基本上,您的 cron 作业必须调用 API,仅此而已。

send email through API with your own html content

send email through API with a template created in mandrill

【讨论】:

    猜你喜欢
    • 2011-11-17
    • 1970-01-01
    • 2014-05-30
    • 2015-10-13
    • 2011-05-18
    • 1970-01-01
    • 2014-07-24
    • 2014-10-11
    • 1970-01-01
    相关资源
    最近更新 更多