php-如何使用sendgrid发送多封电子邮件,以及如何编辑网站名称标题
作者:互联网
我正在尝试使用send grid作为我的php的电子邮件平台,但问题是我无法发送多封电子邮件作为CC头,而且我无法编辑FROM头以在电子邮件地址前显示名称.
$from = "News Letter <new@gmail.com>" // cannot get the "News Letter" to Display
$cc = array("aaaaaa@gmail.com","bbbbb@gmail.com");// doesnt send to arrays
$params = array(
'api_user' => $user,
'api_key' => $pass,
'to' => $to,
'cc' => $cc,
'subject' => $subject,
'html' => $body,
'from' => $headers
);
解决方法:
您需要在$params数组中使用一些其他字段,如下所示:
$params = array(
'api_user' => $user,
'api_key' => $pass,
'to' => $to,
'toname' => 'Newsletter Person',
'cc' => $cc,
'subject' => $subject,
'html' => $body,
'from' => $headers,
'fromname' => 'Newsletter'
);
直接通过Mail.Send端点发送的Sendind不允许在“抄送”字段中使用数组,但是,如果使用SendGrid PHP library,则表示can use and array for CC
标签:cc,email,header,sendgrid,php 来源: https://codeday.me/bug/20191120/2041507.html