You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+64-2Lines changed: 64 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,69 @@ Transmission endpoints are now under `$sparky->transmissions` instead of `$spark
17
17
* The exceptions to the previous statement are `cc` and `bcc`. They are helpers to make it easier to add cc and bcc recipients. [Example](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#send-an-email-using-the-transmissions-endpoint)
18
18
19
19
### Switched from Ivory Http Adapter to HTTPlug
20
-
Ivory Http Adapter was deprecated in favor fo HTTPlug.
20
+
Ivory Http Adapter was deprecated in favor of HTTPlug.
21
21
22
22
### Asynchronous support
23
-
We addeded in support for [asynchronous calls](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#asynchronous) (assuming your client supports it).
23
+
We addeded in support for [asynchronous calls](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#asynchronous) (assuming your client supports it).
24
+
25
+
### Example
26
+
#### 2.0
27
+
```php
28
+
try {
29
+
$sparky->setOptions([ 'async' => false ]);
30
+
// Build your email and send it!
31
+
$results = $sparky->transmissions->post([
32
+
'content'=>[
33
+
'from'=>[
34
+
'name' => 'From Envelope',
35
+
'email' => 'from@sparkpostbox.com>'
36
+
],
37
+
'subject'=>'First Mailing From PHP',
38
+
'html'=>'<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
39
+
'text'=>'Congratulations, {{name}}!! You just sent your very first mailing!',
40
+
],
41
+
'substitution_data'=>['name'=>'YOUR FIRST NAME'],
42
+
'recipients'=>[
43
+
[
44
+
'address'=>[
45
+
'name'=>'YOUR FULL NAME',
46
+
'email'=>'YOUR EMAIL ADDRESS'
47
+
]
48
+
]
49
+
]
50
+
]);
51
+
echo 'Woohoo! You just sent your first mailing!';
52
+
} catch (\Exception $err) {
53
+
echo 'Whoops! Something went wrong';
54
+
var_dump($err);
55
+
}
56
+
```
57
+
58
+
#### 1.0
59
+
```php
60
+
try {
61
+
// Build your email and send it!
62
+
$results = $sparky->transmission->send([
63
+
'from'=>[
64
+
'name' => 'From Envelope',
65
+
'email' => 'from@sparkpostbox.com>'
66
+
],
67
+
'html'=>'<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
68
+
'text'=>'Congratulations, {{name}}!! You just sent your very first mailing!',
0 commit comments