PHP code example of xcode75 / postal
1. Go to this page and download the library: Download xcode75/postal library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xcode75 / postal example snippets
// Create a new Postal client using the server key you generate in the web interface
$client = new Postal\Client('https://postal.yourdomain.com', 'your-api-key');
// Create a new message
$message = new Postal\SendMessage($client);
// Add some recipients
$message->to('[email protected]');
$message->to('[email protected]');
$message->cc('[email protected]');
$message->bcc('[email protected]');
// Specify who the message should be from. This must be from a verified domain
// on your mail server.
$message->from('[email protected]');
// Set the subject
$message->subject('Hi there!');
// Set the content for the e-mail
$message->plainBody('Hello world!');
$message->htmlBody('<p>Hello world!</p>');
// Add any custom headers
$message->header('X-PHP-Test', 'value');
// Attach any files
$message->attach('textmessage.txt', 'text/plain', 'Hello world!');
// Send the message and get the result
$result = $message->send();
// Loop through each of the recipients to get the message ID
foreach ($result->recipients() as $email => $message) {
$email; // The e-mail address of the recipient
$message->id(); // Returns the message ID
$message->token(); // Returns the message's token
}