Git Product home page Git Product logo

laravel-sendcloud's Introduction

Laravel-SendCloud

Laravel 5.X 的 SendCloud 驱动

Laravel 5.5 以下请使用 1.1.3 版本

优点:

普通发送方式完全兼容官方用法,可随时修改配置文件改为其他驱动,而不需要改动业务代码

安装

在项目目录下执行

composer require naux/sendcloud

配置

修改 config/app.php,添加服务提供者

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

.env 中配置你的密钥, 并修改邮件驱动为 sendcloud

MAIL_DRIVER=sendcloud

SEND_CLOUD_USER=   # 创建的 api_user
SEND_CLOUD_KEY=    # 分配的 api_key

使用

普通发送:

用法完全和系统自带的一样, 具体请参照官方文档: http://laravel.com/docs/5.1/mail

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

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

模板发送

用法和普通发送类似,不过需要将 body 设置为 SendCloudTemplate 对象

使用模板发送不与其他邮件驱动兼容 !!!

// 模板变量
$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]');
});

Sponsors

laravel-sendcloud's People

Contributors

nauxliu avatar wangyan avatar yushine avatar aufree avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.