$config['api-key']]); try { $results = $sparky->transmission->send([ 'from' => [ 'name' => 'From Envelope', 'email' => 'from@sparkpostbox.com', ], 'html' => '

An example email using cc with SparkPost to the {{recipient_type}} recipient.

', 'text' => 'An example email using cc with SparkPost to the {{recipient_type}} recipient.', 'subject' => 'Example email using cc', 'recipients' => [ [ 'address' => [ 'name' => 'Original Recipient', 'email' => 'original.recipient@example.com', ], 'substitution_data' => [ 'recipient_type' => 'Original' ] ], [ 'address' => [ 'name' => 'Carbon Copy Recipient', 'email' => 'cc.recipient@example.com', 'header_to' => '"Original Recipient" ', ], 'substitution_data' => [ 'recipient_type' => 'CC' ] ], ], 'customHeaders' => [ 'CC' => '"Carbon Copy Recipient" ' ] ]); echo 'Congrats! You sent an email with cc using SparkPost!'; } catch (\Exception $exception) { echo $exception->getAPIMessage()."\n"; echo $exception->getAPICode()."\n"; echo $exception->getAPIDescription()."\n"; }