定制 sahil-gulati/mr-email 二次开发

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

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

sahil-gulati/mr-email

Composer 安装命令:

composer require sahil-gulati/mr-email

包简介

AWS SES raw email bulk sending.

README 文档

README

AWS SES(Simple Email Service) raw emails bulk sending. This library enables a user to gather multiple email requests and execute those requests in one go. Each email request can be altered with customized options available for generating raw email content.

Installation

composer require sahil-gulati/mr-email

OR

{
    "require":{
        "sahil-gulati/mr-email": "2.0.0"
    }
}

composer install

Note:
AWS V3 signature is supported in version 1.0.0.
AWS V4 signature is supported in version 2.0.0.

Creating SES Email

$sesEmail = new SESEmail("callback_function","AWSKEYXXXX","AWSSECRET-XXXXXX","us-east-1");

Creating SES EmailRequest

$sesRequestObj=new SESEmailRequest();
$sesRequestObj
    ->addReceiver($receiverEmail) 
    ->addSenderEmail($senderEmail)
    ->addSenderName($senderName)
    ->setContentType("application/json")  //Added in version 2.0.0
    ->setEmailSubject("testing email1!")
    ->setEmailBody("This is a email body")
    ->makeContent();

Adding SES EmailRequest

/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest($sesRequestObj);

Execution

/**
 * Executing gathered request
 */
$sesEmail->execute();
function callback_function($response,$requestNo,$parameters,$groupNo)
{
    print_r(func_get_args());
}

Running test

require_once 'vendor/autoload.php';
/**
 * Using namespace of MREmail
 */
use MREmail\SESEmail as SESEmail;
use MREmail\SESEmailRequest as SESEmailRequest;

$receiverEmail="sahil.gulati1991@outlook.com";
$senderEmail="someemail@gmail.com";
$senderName="Sahil Gulati";
/**
 * Note: While sending test email $senderEmail must be equal to $receiverEmail.
 */
$sesEmail = new SESEmail("callback_function","AWSKEYXXXX","AWSSECRET-XXXXXX","us-east-1");
$sesEmail->sendTestEmail($senderEmail);

Complete example with all together

<?php

require_once 'vendor/autoload.php';
/**
 * Using namespace of MREmail
 */
use MREmail\SESEmail as SESEmail;
use MREmail\SESEmailRequest as SESEmailRequest;

$receiverEmail="sahil.gulati1991@outlook.com";
$senderEmail="someemail@gmail.com";
$senderName="Sahil Gulati";
/**
 * Initiating object of SESEmail
 * Callback function type
 * (String) `callback_function` global function
 * (Array) array => 0 (Object) $classObject array => 1 (String) function_name(public) 
 * (Array) array => 0 (String) class_name array => 1 (String) function_name(public static) 
 */
$sesEmail = new SESEmail("callback_function","AWSKEYXXXX","AWSSECRET-XXXXXX","us-east-1");
/**
 * Initiating object of SESEmail request 1
 */
$sesRequestObj=new SESEmailRequest();
/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest(
            $sesRequestObj
            ->addReceiver($receiverEmail)
            ->addSenderEmail($senderEmail)
            ->addSenderName($senderName)
            ->setContentType("application/json")
            ->setEmailSubject("testing email1!")
            ->setEmailBody("This is a email body")
            ->makeContent()
        );
/**
 * Initiating object of SESEmail request 2
 */
$sesRequestObj=new SESEmailRequest();
/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest(
            $sesRequestObj
            ->addReceiver($receiverEmail)
            ->addSenderEmail($senderEmail)
            ->addSenderName($senderName)
            ->setEmailSubject("testing email2!")
            ->setEmailBody("This is a email body")
            ->makeContent()
        );
/**
 * Initiating object of SESEmail request 3
 */
$sesRequestObj=new SESEmailRequest();
/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest(
            $sesRequestObj
            ->addReceiver($receiverEmail)
            ->addSenderEmail($senderEmail)
            ->addSenderName($senderName)
            ->setEmailSubject("testing email3!")
            ->setEmailBody("This is a email body")
            ->makeContent()
        );
/**
 * Executing gathered request
 */
$sesEmail->execute();
function callback_function($response,$requestNo,$parameters,$groupNo)
{
    print_r(func_get_args());
}

?>

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-11-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固