定制 buzzingpixel/corbomite-mailer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

buzzingpixel/corbomite-mailer

最新稳定版本:1.1.0

Composer 安装命令:

composer require buzzingpixel/corbomite-mailer

包简介

Corbomite Mailer

README 文档

README

Part of BuzzingPixel's Corbomite project.

Provides transaction email capabilities.

Usage

Queue

The Mailer makes use of the Corobomite Queue feature so be sure you have the queue running.

Webmaster From and Email environment variables

For deliverability, emails are ways sent from the the webmaster email. Be sure to set the following environment variables:

  • WEBMASTER_EMAIL_ADDRESS=info@mysite.com
  • WEBMASTER_NAME="Some Name"

CORBOMITE_MAILER_ADAPTER_CLASS environment variable

To set what adapter the mailer uses, make sure to set the CORBOMITE_MAILER_ADAPTER_CLASS environment variable to a fully qualified class name of an adapter. The built-in adapters are:

  • buzzingpixel\corbomitemailer\adapters\SendGridSendMailAdapter
  • buzzingpixel\corbomitemailer\adapters\MandrillMailSendMailAdapter
  • buzzingpixel\corbomitemailer\adapters\MailGunSendMailAdapter
  • buzzingpixel\corbomitemailer\adapters\PostMarkSendMailAdapter

You can also write your own adapter. It must implement buzzingpixel\corbomitemailer\interfaces\SendMailAdapterInterface.

Built-in Adapter Environment variables

SendGridSendMailAdapter

To use the SendGridSendMailAdapter, be sure to set the SENDGRID_API_KEY environment variable.

MandrillMailSendMailAdapter

To use the MandrillMailSendMailAdapter, be sure to set the MANDRILL_API_KEY environment variable.

MailGunSendMailAdapter

To use the MailGunSendMailAdapter, be sure to set the MAILGUN_API_KEY and MAILGUN_DOMAIN environment variables.

PostMarkSendMailAdapter

To use the PostMarkSendMailAdapter, be sure to set the POSTMARK_SERVER_TOKEN environment variable.

Sending email

<?php
declare(strict_types=1);

use corbomite\di\Di;
use buzzingpixel\corbomitemailer\interfaces\EmailApiInterface;

/**
 * Requesting the EmailApiInterface will return an instance of \buzzingpixel\corbomitemailer\EmailApi
 * You can override it with your own implementation by setting to return value of PHP-DI for
 * the interface to your own implementation
 */
$emailApi = Di::diContainer()->get(EmailApiInterface::class);

$emailModel = $this->emailApi->createEmailModel([
    'fromName' => 'Some Name', // Optional, fromEmail must be set
    'fromEmail' => 'Some Email', // Optional
    'toName' => 'Some Name', // Optional
    'toEmail' => 'someone@domain.com', // Required
    'subject' => 'Some Subject', // Required
    'messagePlainText' => 'Plaintext Content', // Required if messageHtml not set. Derived from messageHtml if not set
    'messageHtml' => '<p>Html Content</p>', // Required if messagePlainText not set
]);

// Add the email to the queue and let the queue runner send it (recommended)
$emailApi->addEmailToQueue($emailModel);

// Send the email right away (avoid if possible)
$emailApi->sendEmail($emailModel);

License

Copyright 2019 BuzzingPixel, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-01-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固