Adding Multiple Recipients using Sendgrid marketing Email in PHP
Hi I am using Sendgrid marketing email API to send bulk of emails.Here i need to add multiple recipients in the list. I have seen lots of answers but i am not clear with any answer. This is the code I'm using to add single email to the list.
$data=array('email'=>'[email protected]',
'name'=>'XXXXX',
);
$email_add_data=array(
'api_user'=>$user,
'api_key'=>$password,
'list'=>$list_name,
'data'=> json_encode($data)
);
In the above code, how can i change the data array, so that I can be able to add multiple email recipients address
Answer
Solution:
You would pretty much need a
&data[]=
param for each recipient you need added to your list. That's why you'd have to loop through your data, like this: