Sendcloud driver installation tutorial for laravel 5.1


The normal sending mode is fully compatible with the official usage, and the configuration file can be changed to other drivers at any time without changing the code

Execute in the project directory

composer require naux/sendcloud
to configure
Modify config/ app.php

‘providers’ => [
//Add this line
Naux\Mail\ SendCloudServiceProvider::class,
Configure your key in. Env and modify the email driver to sendcloud


SEND_ CLOUD_ User = # created API_ user
SEND_ CLOUD_ Key = # assigned API_ key
Normal sending:
The usage is exactly the same as that of the system. Please refer to the official document for

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

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

Template sending
The usage is similar to ordinary sending, but you need to set the body as the sendcloudtemplate object. There are several ways to achieve this

First usage:
Mail:: send (‘Send an empty view ‘, [], function ($message){
$message->from(‘[email protected]‘, ‘Laravel’);

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

//Template variables
$bind_data = ['url' => ''];
$template = new sendcloudtemplate ('template name ', $bind_ data);


Second usage:
//Template variables
$bind_data = [‘url’ => ‘’];
$template = new sendcloudtemplate (‘template name ‘, $bind’)_ data);

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

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


Original author: naux Liu
From link:Tutorial: sendcloud driver for laravel 5.1
Copyright notice: the copyright belongs to the author. For commercial reprint, please contact the author for authorization. For non-commercial reprint, please keep the above author information and original link.

This work adoptsCC agreementReprint must indicate the author and the link of this article