PHP code example of mrjulio / rapture-message

1. Go to this page and download the library: Download mrjulio/rapture-message 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/ */

    

mrjulio / rapture-message example snippets


$message= new Message([
    'subject'   =>  'Hello',
    'body'      =>  'Lorem ipsum...'
]);
$message->setSender('[email protected]');

$mailgun = new Mailgun(['api-key' => '98asd0as09ds']);
$request = $mailgun->getRequest($message);
$client  = new \Rapture\Http\Client;

$response = $httpClient->sendRequest($request);

if ($response->getStatusCode() === \Rapture\Http\Response::STATUS_OK) {
    echo 'Success!';
}
else {
    echo 'Failed!';
}