rareloop/lumberjack-email 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rareloop/lumberjack-email

最新稳定版本:v1.5.0

Composer 安装命令:

composer require rareloop/lumberjack-email

包简介

README 文档

README

This package provides a simple way to send rich emails using Twig templates. A small wrapper around wp_mail();

Once installed, register the Service Provider in config/app.php:

'providers' => [
    ...

    Rareloop\Lumberjack\Email\EmailServiceProvider::class,

    ...
],

Sending Emails

You then have access to the Rareloop\Lumberjack\Email\Facades\Email facade and can create emails:

Send an HTML email

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendHTML(
    'recipient@mail.com',
    'Email Subject line',
    '<p>Email body goes here</p>'
);

// Or with a reply-to email
Email::sendHTML(
    'recipient@mail.com',
    'Email Subject line',
    '<p>Email body goes here</p>',
    'reply-to@mail.com'
);

Send an HTML email using a Twig template

The twig file will be compiled using Timber before sending.

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendHTMLFromTemplate(
    'recipient@mail.com',
    'Email Subject line',
    'email.twig',
    [ 'name' => 'Jane Doe' ] // Twig context
);

Send a plain text email

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendPlain(
    'recipient@mail.com',
    'Email Subject line',
    'Plain text body',
);

Send an email with attachments

Each send method accepts an optional attachments parameter which will be passed on to wp_mail as it is received.

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendPlain(
    'recipient@mail.com',
    'Email Subject line',
    'Plain text body',
    false,  // Set reply-to to false if you don't need it, necessary because attachments is the final argument
    ['/path/to/file.pdf']
);

Config

You can also specify an SMTP server to use for emails by creating a config/email.php file:

return [
    'smtp' => [
        'hostname' => '',
        'username' => '',
        'password' => '',
        'auth' => true|false,
        'port' => '',
    ],
];

统计信息

  • 总下载量: 70.58k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-02-05