1010
1111$ httpClient = new GuzzleAdapter (new Client ());
1212
13- /**
13+ /*
1414 * configure options in example-options.json
1515 */
1616$ sparky = new SparkPost ($ httpClient , $ options );
1717
1818$ promise = $ sparky ->transmissions ->post ([
19- 'content ' => [
20- 'from ' => [
19+ 'content ' => [
20+ 'from ' => [
2121 'name ' => 'SparkPost Team ' ,
22- 'email ' => 'from@sparkpostbox.com '
22+ 'email ' => 'from@sparkpostbox.com ' ,
2323 ],
24- 'subject ' => 'First Mailing From PHP ' ,
25- 'html ' => '<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html> ' ,
26- 'text ' => 'Congratulations, {{name}}!! You just sent your very first mailing! '
24+ 'subject ' => 'First Mailing From PHP ' ,
25+ 'html ' => '<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html> ' ,
26+ 'text ' => 'Congratulations, {{name}}!! You just sent your very first mailing! ' ,
2727 ],
28- 'substitution_data ' => ['name ' =>'YOUR_FIRST_NAME ' ],
29- 'recipients ' => [
30- [ 'address ' => 'YOUR_NAME <YOUR_EMAIL> ' ]
28+ 'substitution_data ' => ['name ' => 'YOUR_FIRST_NAME ' ],
29+ 'recipients ' => [
30+ [
31+ 'address ' => [
32+ 'name ' => 'YOUR_NAME ' ,
33+ 'email ' => 'YOUR_EMAIL ' ,
34+ ],
35+ ],
36+ ],
37+ 'cc ' => [
38+ [
39+ 'address ' => [
40+ 'name ' => 'ANOTHER_NAME ' ,
41+ 'email ' => 'ANOTHER_EMAIL ' ,
42+ ],
43+ ],
3144 ],
32- 'cc ' => [
33- [ 'address ' => 'ANOTHER_NAME <ANOTHER_EMAIL> ' ]
45+ 'bcc ' => [
46+ [
47+ 'address ' => [
48+ 'name ' => 'AND_ANOTHER_NAME ' ,
49+ 'email ' => 'AND_ANOTHER_EMAIL ' ,
50+ ],
51+ ],
3452 ],
35- 'bcc ' => [
36- [ 'address ' => 'AND_ANOTHER_NAME <AND_ANOTHER_EMAIL> ' ]
37- ]
3853]);
3954
4055try {
4156 $ response = $ promise ->wait ();
42- echo $ response ->getStatusCode () . "\n" ;
57+ echo $ response ->getStatusCode (). "\n" ;
4358 print_r ($ response ->getBody ());
4459} catch (Exception $ e ) {
45- echo $ e ->getCode () . "\n" ;
46- echo $ e ->getMessage () . "\n" ;
60+ echo $ e ->getCode (). "\n" ;
61+ echo $ e ->getMessage (). "\n" ;
4762}
48- ?>
0 commit comments