radoan/memail

此包将为Laravel应用程序自动化邮件发送过程。

维护者

详细信息

github.com/revendol/memail

来源

问题

安装: 0

依赖者: 0

建议者: 0

安全: 0

星标: 1

观察者: 1

分支: 0

开放问题: 0

语言:HTML

dev-master 2020-04-06 13:24 UTC

This package is auto-updated.

Last update: 2024-09-06 23:05:50 UTC


README

Memail是一个用于自动发送邮件的PHP Laravel库。它位于Laravel Mail之上,并使用活动和模板发送动态邮件。模板可自定义,但活动不可自定义。一旦指定了活动的标题,就无法编辑它。但可以更改相关的模板。

安装

使用composer安装memail。

composer require radoan/memail

服务提供者

在您的config/app.php中添加服务提供者

Radoan\Memail\MemailServiceProvider::class,

外观

在您的config/app.php中添加别名

'Memail' => Radoan\Memail\Facades\Memail::class,

发布供应商

通过以下命令发布供应商文件,并选择Radoan\Memail

php artisan vendor:publish --provider="Radoan\Memail\MemailServiceProvider"

运行迁移命令

运行迁移命令以获取必要的数据库表。

php artisan migrate

更改视图文件

现在您即将出发。您已将包需要的视图文件发布到/resources/views/memail目录。现在您需要根据需要自定义视图。请看下面的示例。

@extends('layout.app')

@section('contents')
    {{-- Keep the views under your layout and sections --}}
@endsection

使用

现在,如果您在.env/config/mail.php中设置了SMTP凭据,则可以发送电子邮件。如果您一切设置正确,则可以使用以下代码发送电子邮件。所有内容将在注释中解释。

Memail::send($to, $campaignTitle, [
        'data'=> [
            //keys are macroses decleared in template
            //Values are data what will replace macros
            'name' => 'Radoan Hossain'
        ],
        'attachments'   => [ 'path/to/attachment/file' ],
        'options'       => [
            //If you need cc
            'cc'        =>  'example@example.com',
            //If you need bcc
            'bcc'       =>  'example@example.com',
            //Enable queue but you will need to configure your queues before using this feature.
            'queue'     =>  true,
            //Delayed Message Queueing but you need to send the time
            //$when = now()->addMinutes(10);
            'later'     =>  $when
        ]
    ]);

贡献

欢迎提交拉取请求。对于重大更改,请首先打开一个问题来讨论您想进行哪些更改。

请确保根据适当的情况更新测试。

许可证

MIT

在upWork上找到我

Radoan Hossan

在领英上找到我

Radoan Hossan