如何使用SendGrid发送多封电子邮件,并编辑网站名称的标题?

3

我尝试将SendGrid作为我的PHP邮件平台,但问题是我不能将多个电子邮件发送到抄送(CC)头部,也不能编辑“发件人”标题以在电子邮件地址前显示名称。

$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
  );
1个回答

3
您需要在$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端点直接发送不允许在CC字段中使用数组,但是如果您使用SendGrid PHP库,则可以使用数组进行CC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接