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

I am trying to use the sending grid as the email framework for my php, but the problem is that I cannot send multiple emails as a CC header, nor can I edit the FROM header to display the name in front of the email address.

$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
  );

      

+3


source to share


1 answer


You need to use some additional fields in the $ params array, for example:

$params = array(
  'api_user'  => $user,
  'api_key'   => $pass,
  'to'        => $to,
  'toname'    => 'Newsletter Person',
  'cc'        => $cc,
  'subject'   => $subject,
  'html'      => $body,
  'from'      => $headers,
  'fromname'  => 'Newsletter'
);

      



Send directly through the Mail.Send endpoint does not allow an array in the CC field, however if you are using the SendGrid PHP library then you can use arrays for CC as well

+3


source







All Articles