使用 PHP 在 SendGrid 中检索积分

Retrieve Credits in SendGrid with PHP

我正在尝试构建一个带有 sendgrid 集成的销售平台,目前由于成本限制,我想将电子邮件交易限制为 sendgrid 的免费计划 400 emails/day。

有没有一种方法可以在 PHP 中以编程方式检索剩余的电子邮件配额?

我看过这个问题 (link),但我不熟悉 ruby,我相信这是一个解决方法。

无法检索配额;可以通过了解您一天收到多少(重置为 00:00 太平洋时间)并减去您发送的内容来推断。

您无法检索信用配额,但 SendGrid 会出错并且响应会说您已超出信用配额。

一直发送,出错就停止

您需要将用户设置为主帐户的子用户,然后使用 Customer Subuser API to check/limit the credits. However, the Customer Subuser API is only available to customers on SendGrid's Silver plan and higher,因此如果您使用的是免费计划,则无法执行此操作.