PHP code example of silinternational / email-service-php-client

1. Go to this page and download the library: Download silinternational/email-service-php-client 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/ */

    

silinternational / email-service-php-client example snippets




use Sil\EmailService\Client\EmailServiceClient;

$emailServiceClient = new EmailServiceClient(
    'https://api.example.com/', // The base URI for the API.
    'DummyAccessToken', // Your HTTP header authorization bearer token.
    [
        'http_client_options' => [
            'timeout' => 10, // An (optional) custom HTTP timeout, in seconds.
        ],
    ]
);

$email = $emailServiceClient->email([
    "to_address" => "[email protected]",
    "cc_address" => "[email protected]",   // optional
    "bcc_address" => "[email protected]",    // optional
    "subject" => "Test Subject",
    "text_body" => "this is text",        // either text_body or html_body is 

$email = $emailServiceClient->email([
    "to_address" => "[email protected]",
    "subject" => "Test Subject",
    "html_body" => "<b>this is html</b>",
    "delay_seconds" => "3600",
]);

$email = $emailServiceClient->email([
    "to_address" => "[email protected]",
    "subject" => "Test Subject",
    "html_body" => "<b>this is html</b>",
    "send_after" => "1556825944",
]);