elite50/e50-mail-laravel

支持多个 Mailgun 域的 Laravel 邮件外观。

v1.3.0 2018-07-12 15:03 UTC

This package is not auto-updated.

Last update: 2024-09-27 16:17:40 UTC


README

是 Laravel 邮件外观的扩展,允许动态配置。

使用外观

通过 composer 安装

composer require elite50/e50-mail-laravel

app/config/app.php 中包含

'providers' => array (
    ...
    'Elite50\E50MailLaravel\E50MailServiceProvider',
),

'aliases' => array (
    ...
    'E50Mail' => 'Elite50\E50MailLaravel\Facades\E50Mail',
    'E50MailWorker' => 'Elite50\E50MailLaravel\E50MailWorker',
)

在您的应用程序中使用外观

示例
E50Mail::queue(
    // Sender domain (required for Mailgun only)
    'example.com',

    // Views
    ['html' => 'views.html-email'],

    // View data
    ['name' => 'John Doe'],

    // Message data
    [
        'toEmail' => 'john@example.com',
        'toName' => 'John Doe',
        'fromEmail' => 'robot@example.com',
        'fromName' => 'Mail Robot',
        'subject' => 'Action Required!',
        'headers' => [
            'X-Mail-Header' => 'abcd1234',
        ],
    ],

    // Custom driver (DEPRECATED - use custom mail config)
    'mailgun',

    // Custom queue
    'QueueName',

    // Custom mail config
    [
        'driver' => 'smtp',
        'host' => 'smtp.myhost.com',
    ]
);