-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBasicWithInvalidRecipients.php
More file actions
29 lines (21 loc) · 994 Bytes
/
BasicWithInvalidRecipients.php
File metadata and controls
29 lines (21 loc) · 994 Bytes
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
<?php
include_once (__DIR__ . "../../../includes.php");
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\BasicMessage;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("from@example.com");
//Valid
$message->addToAddress(new EmailAddress("this@works"));
$message->addToAddress(new EmailAddress("recipient@example.com"));
//Invalid
$message->addToAddress(new EmailAddress("!@#$!@#$!@#$@#!$"));
$message->addToAddress(new EmailAddress("failure.com"));
$message->addToAddress(new EmailAddress("ImMissingSomethin"));
$message->addToAddress(new EmailAddress("Fail@@!.Me"));
$response = $client->send($message);