Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/venoel/mailgunapi
Simple Mailgun API for Yii 1.x
https://github.com/venoel/mailgunapi
mailgun-api yii yii1
Last synced: 2 months ago
JSON representation
Simple Mailgun API for Yii 1.x
- Host: GitHub
- URL: https://github.com/venoel/mailgunapi
- Owner: venoel
- Created: 2018-08-11T19:25:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-14T20:09:20.000Z (over 6 years ago)
- Last Synced: 2024-07-30T21:07:36.589Z (5 months ago)
- Topics: mailgun-api, yii, yii1
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mailgun API for Yii 1.x #
## Introduction ##
This simple Yii extension allow send email in HTML format through Mailgun API. It is easy switch between sandbox and real domain.
Yii is a fast, secure, and efficient PHP framework. https://www.yiiframework.com/
Mailgun - Powerful APIs that enable you to send, receive and track email effortlessly. Powerful APIs that enable you to send,
receive and track email effortlessly. https://www.mailgun.com/## Usage ##
Download Mailgun.php and place it in ```/protected/extension``` directory.
Set configuration.
```/protected/config/main.php```
```
'components'=>array(
...
'mailgun' => array(
'class' => 'ext.Mailgun',
'sandboxUrl' => 'https://api.mailgun.net/v3/',
'url' => 'https://api.mailgun.net/v3/',
'apikey' => '',
'useSandbox' => true,
),
...
);
```In some controller
```
$mailgun = Yii::app()->mailgun;
$res = $mailgun->send('[email protected]','[email protected]','Hello','Test1
');
var_dump($res,$mailgun->getStatus());
```## Configuration ##
*class* - path to Mailgun.php
*sandboxUrl* - sandbox domain. See https://app.mailgun.com/app/domains
*url* - Your real domain. See https://app.mailgun.com/app/domains
*apikey* - See API key in Domain Information section.
*useSandbox* - switch between sandbox and real domain. If ```true``` *sandboxUrl* is used. If ```false``` *url* is used.
## Sending email ##
```send($from,$to,$subject,$htmlBody)``` Send email. Return ```true``` on success.
```getStatus()``` Get status of last request.