I am using this script to send out email via cURL. I am not using the sendgrid library and I already looked at the API docs. I would like the option to send to multiple "to" addresses. How can I properly do this?
$params = array(
    'to'        => $to,   
    'subject'   => $title,
    'text'      => 'Subject',
    'from'      => '[email protected]',
);
$request =  $url.'api/mail.send.json';
$headr = array();
// set authorization header
$headr[] = 'Authorization: Bearer '.$pass;
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// add authorization header
curl_setopt($session, CURLOPT_HTTPHEADER,$headr);
$response = curl_exec($session);
curl_close($session);
                Try
    $params = array(
    'to[0]'        => $to1,   
    'to[1]'        => $to2,
    );
it was worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With