承接 leoflapper/mailprovider 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

leoflapper/mailprovider

最新稳定版本:v1.1.2

Composer 安装命令:

composer require leoflapper/mailprovider

包简介

Allows you to quickly send mails with different mail services like PHPMailer, Mandrill, SendGrind and Mailgun

README 文档

README

MailProvider allows you to quickly send mails with PHPMailer or different mail services like Mandrill, SendGrind or Mailgun.

Usage

The MailProvider allows you to compose an email in a single format. You only have to choose the desired service.

PHPMailer

    $service = new MailProvider\Service\PHPMailer();
    $service
        ->setProtocol('smtp')
        ->setHost('localhost')
        ->setPort(1025)
        ->addTo('info@myemail.nl', 'Leo Flapper')
        ->addCc('cc@myemail.nl', 'Leo Flapper')
        ->addBcc('bcc@myemail.nl', 'Leo Flapper')
        ->setFrom('info@myhost.nl', 'Leo Flapper')
        ->setSubject('My Subject')
        ->setHtml('<p>Beautiful content</p>')
        ->addAttachment('../LICENSE.md', 'Attachment.txt')
        ->addHeader('MyHeader', 'Value')
        ->setReplyTo('reply@myemail.nl');

    $service->send();

Other mail services

    //$service = new MailProvider\Service\SendGrid('API-KEY');
    //$service = new MailProvider\Service\Mailgun('API-KEY');
    $service = new MailProvider\Service\Mandrill('API-KEY');
    $service
        ->addTo('info@myemail.nl', 'Leo Flapper')
        ->addCc('cc@myemail.nl', 'Leo Flapper')
        ->addBcc('bcc@myemail.nl', 'Leo Flapper')
        ->setFrom('info@myhost.nl', 'Leo Flapper')
        ->setSubject('My Subject')
        ->setText('My text')
        ->setHtml('<p>Beautiful content</p>')
        ->addAttachment('../LICENSE.md', 'Attachment.txt')
        ->addHeader('MyHeader', 'Value')
        ->setReplyTo('reply@myemail.nl');
    $service->send();

Installation

Add MailProvider to your composer.json file. If you are not using Composer, you should be. It's an excellent way to manage dependencies in your PHP application.

{  
  "require": {
    "leoflapper/mailprovider": "dev-master"
  }
}

Then at the top of your PHP script require the autoloader:

require 'vendor/autoload.php';

Example

There are different examples located inside the examples directory.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-24