承接 iyngaran/send-grid-transport 相关项目开发

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

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

iyngaran/send-grid-transport

Composer 安装命令:

composer require iyngaran/send-grid-transport

包简介

SendGrid Transport for Zend Framework 3 to send emails using SendGrid - https://sendgrid.com/.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License Codacy Badge

This module can be use as a transport to send transactional e-mail using SendGrid API in Zend Framework 2.

INSTALLING

composer require iyngaran/send-grid-transport

After install follow one of these steps:

  1. Copy the contents file vendor/iyngaran/send-grid-transport/mail.global.php.dist and put it in your config/autoload/mail.global.php.

  2. If this file does not exists in your application, just copy the entire file and place into your config/autoload removing the .dist extension.

Then add your SendGrid API Key. To get your API Key, please visit

And also add the test email from-email address, name and to-email address, name.

// config/autoload/mail.global.php

return [
    'mail' => [
        'sendgrid' => [
            'api_key' => 'YOUR_API_KEY',
        ]
    ],
    'test-email' => [
        'from' => [
            'name' => 'Iyngaran Iyathurai',
            'email' => 'test@iyngaran.info'
        ],
        'to' => [
            'name' => 'Your name',
            'email' => 'your email address'
        ]
    ]
];

After all, you must register SendGridTransport module in your config/modules.config.php.

// config/modules.config.php
return [
    'Zend\ServiceManager\Di',
    ....
    'Application',
    'SendGridTransport'
];

TESTING

Go to this Url - /send-grid-email to send a test email.

USAGE

Example in a controller

namespace SendGridTransport\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use SendGridTransport\Mail\Transport\SendGridTransport;

class SendEmailController extends AbstractActionController
{
    private $sendGridTransport;
    private $config;

    public function __construct(SendGridTransport $sendGridTransport, array $config)
    {
        $this->sendGridTransport = $sendGridTransport;
        $this->config = $config;
    }


    public function indexAction()
    {
        $message = new \SendGridTransport\Mail\Message();
        $body = '<strong>Hello :),</strong><BR/> The SendGridTransport is working now :)';
        $message->setBody($body);
        $message->setFrom(
            new \Zend\Mail\Address(
                $this->config['test-email']['from']['email'],
                $this->config['test-email']['from']['name']
            )
        );
        $message->addTo(
            new \Zend\Mail\Address(
                $this->config['test-email']['to']['email'],
                $this->config['test-email']['to']['name']
            )
        );
        $message->setSubject('Testing SendGridTransport - Iyngaran');
        $message->setBodyText('Hello, the SendGridTransport is working now :)');
        print('<pre>');
        print_r($this->sendGridTransport->send($message));
        print('<pre/>');

        return [];
    }
}

Is strongly recommended to use the already registered service.

CONTRIBUTING

You can contribute with this module suggesting improvements, making tests and reporting bugs. Use issues for that.

ERRORS

Report errors opening Issues.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固