PHP code example of overtrue / sendcloud

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

    

overtrue / sendcloud example snippets


use Overtrue\SendCloud\SendCloud;

$apiUser = 'overtrue_test_xxxx';
$apiKey = 'UWoBGa2sgxyxxxxxxxx';

$client = new SendCloud($apiUser, $apiKey);

$result = $client->post('/mail/send', [
    'from' => '[email protected]',
    'to' => '[email protected]',
    'subject' => '来自 SendCloud 的第一封邮件!',
    'html' => '你太棒了!你已成功的 从 SendCloud 发送了一封测试邮件!',
]);

var_dump($result);

//{
//    "result": true,
//    "statusCode": 200,
//    "message": "请求成功",
//    "info": {
//        "emailIdList": [
//            "1513828329529_91891_27315_500.sc-10_9_13_218-inbounddemo@easywechat.com"
//        ]
//    }
//}⏎