定制 awsm3/mailgun-zend3 二次开发

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

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

awsm3/mailgun-zend3

Composer 安装命令:

composer require awsm3/mailgun-zend3

包简介

A PHP client library for Mailgun's REST API for Zend Framework 3

README 文档

README

A PHP ZF3 client library for Mailgun's API.

This library provides all of the functionality present in the official PHP client, but makes use of namespaces, provides helper classes to ease message sending and works with Zend Framework 3 (uses its library).

Installation Using Composer

Assuming composer.phar is located in your project's root directory, run the following command:

composer require awsm3/mailgun-zend3

Usage

Sending a Message

/** @uses */
use ZendMailgun\{
    Mailgun,
    Struct\Message,
    Struct\Sender,
    Struct\Recipient,
    Struct\RecipientsList
}

// Instantiate a client object
$transport = new Mailgun('your_api_key');

// Instantiate a sender
$sender = new Sender('test@example.com', 'Your name');
 
// Instantiate a Message object
$message = new Message();
 
// Define message properties
$message->setText('Hello, username');
$message->setSubject('Test');
$message->setFrom($sender->prepare());
 
// Instantiate a Recipient object and add details
$recipient = new Recipient();
$recipient->setEmail('recipient.email@example.com');
$recipient->setName('Recipient Name');
 
// Add the recipient to the message
$message->setTo($recipient->prepare());

// Or make recipients list
$recipientsList = new RecipientsList(
    new Recipient('recipient-1@mail.com', 'Recipient 1'),
    new Recipient('recipient-2@mail.com', 'Recipient 2'),
);
$message->setTo($recipientsList->prepare());
 
// Send the message
$response = $transport->messages()->send('your-domain', $message);

Sending a ZF3 Message

/** @uses */
use ZendMailgun\{
    Mailgun,
    Struct\Message,
    Struct\Sender,
    Struct\Recipient,
    Struct\RecipientsList
}
 
// Convert from ZF message
// $zfMessage is instance of \Zend\Mail\Message
$message = Message::fromZendMessage($zfMessage);

// Instantiate a client object
$transport = new Mailgun('your_api_key');
 
// send the message
$response = $transport->messages()->send('your-domain', $message);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-06