-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmails.php
More file actions
executable file
·85 lines (72 loc) · 1.99 KB
/
Emails.php
File metadata and controls
executable file
·85 lines (72 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
* This file is part of the Redlink PHP API Client.
*
* (c) Mateusz Żyła <mateusz.zylaa@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Plotkabytes\RedlinkApi\DefaultClient;
use Plotkabytes\RedlinkApi\Utils\ResponseTransformer;
require __DIR__ . '/../vendor/autoload.php';
$client = new DefaultClient();
$client->setAuthentication("ENTER_API_KEY_HERE", "ENTER_APPLICATION_KEY_HERE");
$responseTransformer = new ResponseTransformer();
// List all templates using pagination.
$response = $client->emails()->listTemplates("1.test.smtp");
// List all smtp accounts.
$response = $client->emails()->listSmtp();
// List statuses.
$response = $client->emails()->listStatuses("1.test.smtp");
// List clicks.
$response = $client->emails()->listClicks("1.test.smtp");
// List opens.
$response = $client->emails()->listOpens("1.test.smtp");
// Send email.
$response = $client->emails()->send([
'subject' => 'Test email subject',
'smtpAccount' => '1.test.smtp',
'tags' => [
'test-tag',
],
'content' => [
'html' => '<h1>Hello world</h1>',
'text' => 'Hello world',
'templateId' => 'as2sCwq',
],
'bcc' => [
[
'email' => 'string',
'name' => 'string',
],
],
'cc' => [
[
'email' => 'string',
'name' => 'string',
],
],
'from' => [
'email' => 'string',
'name' => 'string',
],
'replyTo' => [
'email' => 'string',
'name' => 'string',
],
'headers' => [
'X-TEST-HEADER' => 'val',
],
'to' => [
[
'email' => 'test@domena.pl',
'name' => 'Test sender',
'messageId' => 'test0001@domena.pl',
'vars' => [
'test-var' => 'var-value',
],
],
],
]);
$parsedResponse = $responseTransformer->createFromJson($response->getBody());