如何使用 sendgrid 发送多封电子邮件以及编辑网站名称 header

how to send multiple emails using sendgrid and and also edit header for website name

我正在尝试将发送网格用作我的 php 的电子邮件平台,但问题是我无法将多封电子邮件作为 CC header 发送,而且我也无法编辑 FROM header 在电子邮件地址前显示名称。

$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 端点发送不允许在 CC 字段中使用数组,但是如果您使用 SendGrid PHP library then you can use and array for CC