-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBasicWithAmpBody.php
More file actions
36 lines (30 loc) · 1.12 KB
/
BasicWithAmpBody.php
File metadata and controls
36 lines (30 loc) · 1.12 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
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending a Message with ampBody support";
$message->from = new EmailAddress("from@example.com");
$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1"));
//Pass in the htmlBody with ampBody support
$message->htmlBody = "<html><body><h1>Sending A Test Message</h1><p>This HTML will show if AMP is not supported.</p></body></html>";
$message->ampBody = "<!doctype html>" +
"<html amp4email>" +
"<head>" +
" <meta charset=\"utf-8\">" +
" <script async src=\"https://cdn.ampproject.org/v0.js\"></script>" +
" <style amp4email-boilerplate>body{visibility:hidden}</style>" +
" <style amp-custom>" +
" h1 {" +
" margin: 1rem;" +
" }" +
" </style>" +
"</head>" +
"<body>" +
" <h1>This is the AMP Html Body of my message</h1>" +
"</body>" +
"</html>";
$response = $client->send($message);