承接 data33/laravel-mailgun 相关项目开发

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

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

data33/laravel-mailgun

Composer 安装命令:

composer require data33/laravel-mailgun

包简介

Send emails from multiple domains with mailgun

README 文档

README

A package for sending emails using the Mailgun HTTP API. One of the main advantages is that you can send emails from any domains connected to your Mailgun API key.

Installation

Open your composer.json file and add the following to the require key:

"data33/laravel-mailgun": "^2"

After adding the key, run composer update from the command line to install the package

composer update

Configuration

Before you can start using the package we need to set some configurations. To do so you must first publish the config file, you can do this with the following artisan command.

php artisan vendor:publish --provider="Data33\LaravelMailgun\Providers\MailgunServiceProvider" --tag="config"

After the config file has been published you can find it at: config/mailgun.php

In it you must specify your Mailgun API key.

Usage with Laravel

Mailgun::send('MAILGUN-URL', 'view', ['viewVariable' => 'value'], function(\Data33\LaravelMailgun\Message $msg){
	$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
		->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
		->setSubject('Test subject');
});

Usage without Laravel

The easiest way to use this package without Laravel is to directly instantiate a Transporter of your choice. For example:

$mg = new Data33\LaravelMailgun\Transporters\AnlutroCurlTransporter('YOUR-MAILGUN-API-KEY');

$result = $mg->send('MAILGUN-URL', ['html' => '<b>Test</b>', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
	$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
		->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
		->setSubject('Test subject');
});

Upgrade from 1.3.0

Since EU domains need calls to a different API URL it seemed fitting to not keep it hardcoded within this package. To upgrade your old code base, change the first argument from domain name to the full URL to Mailgun's Messages API for your domain For example:

$mg = new Data33\LaravelMailgun\Transporters\AnlutroCurlTransporter('YOUR-MAILGUN-API-KEY');

-$result = $mg->send('mydomain.com', ['html' => '<b>Test</b>', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
+$result = $mg->send('https://api.mailgun.net/v3/mydomain.com/messages', ['html' => '<b>Test</b>', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
	$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
		->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
		->setSubject('Test subject');
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固