1

我正在使用 PHP 开发一个项目,其中我使用的是 sendgrid Web API。其中,我想在每周或每月的指定日期由用户发送时事通讯。

我不知道如何在 sendgrid 上管理这个。任何人都可以帮助我并给我解决方案。

4

3 回答 3

1

您正在寻找时事通讯 API,此处记录了该 API:

http://sendgrid.com/docs/API_Reference/Newsletter_API/index.html

具体来说,您可以使用 API 使用 schedule 端点来安排交付:

http://sendgrid.com/docs/API_Reference/Newsletter_API/schedule.html

没有 PHP 包装器,因此您需要使用 curl 或类似的东西发出请求。

于 2013-03-07T16:26:16.887 回答
0

Sendgrid 不提供任何此类服务。

如果您想处理定期发送的时事通讯,那么您可以通过管理数据库和服务器上的 cron 作业来进行管理。

于 2013-03-07T11:08:59.090 回答
0

Download Sendgrid PHP wrapper from here :

https://github.com/sendgrid/sendgrid-php

   include 'path/to/sendgrid-php/SendGrid_loader.php';

   //Initialize the SendGrid object with your SendGrid credentials:
   $sendgrid = new SendGrid('username', 'password');

   //Create a new SendGrid Mail object and add your message details
   $mail = new SendGrid\Mail();
   $mail->
   addTo('foo@bar.com')->
   setFrom('me@bar.com')->
   setSubject('Subject goes here')->
   setText('Hello World!')->
   setHtml('Hello World!');

   //Send it using the Web API like so:
   $sendgrid->
   web->
   send($mail);


Check Sendgrid API documentation here http://sendgrid.com/docs/Code_Examples/php.html

Edit:

Setup cron job on the server to run this script weekly or monthly.

于 2013-03-07T08:37:54.637 回答