PHP code example of kevinzheng / laravel-sendcloud

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

    

kevinzheng / laravel-sendcloud example snippets


'providers' => [
   // 添加这行
    KVZ\Laravel\Mail\SendCloudServiceProvider::class,
];

Mail::send('emails.welcome', $data, function ($message) {
    $message->from('[email protected]', 'Laravel');

    $message->to('[email protected]')->cc('[email protected]');
});

Mail::send('随便传个空view', [], function ($message) {
    $message->from('[email protected]', 'Laravel');

    $message->to('[email protected]')->cc('[email protected]');
    
    // 模板变量
    $bind_data = ['url' => 'http://naux.me'];
    $template = new SendCloudTemplate('模板名', $bind_data);
    
    $message->getSwiftMessage()->setBody($template);
});

// 模板变量
$bind_data = ['url' => 'http://naux.me'];
$template = new SendCloudTemplate('模板名', $bind_data);

Mail::raw($template, function ($message) {
    $message->from('[email protected]', 'Laravel');

    $message->to('[email protected]')->cc('[email protected]');
});