我有简单的sendgrid php脚本来发送电子邮件,这里只有问题是我需要添加更多的收件人,所以这段代码只适用于一个收件人,我正在查看官方文档,但无法找到任何有用的信息,有没有人知道如何以及我需要在这里更改以添加更多收件人/电子邮件。Sendgrid php发送给多个收件人
function sendEmail($subject, $to, $message) {
$from = new SendGrid\Email(null, "[email protected]");
$subject = $subject;
$to = new SendGrid\Email(null, $to);
$content = new SendGrid\Content("text/html", $message);
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$apiKey = 'MY_KEY';
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
}
呼吁每个电子邮件地址的功能。 – muttonUp
代码示例请? –
真的吗?循环访问您的地址并调用该函数。 – muttonUp