https://github.com/czepter/cake-mailjet
Mailjet plugin for CakePHP. Allows sending emails via Mailjet by using the provided Mailjet SDK.
https://github.com/czepter/cake-mailjet
cakephp cakephp-plugin cakephp3 mailer-class mailjet mailjet-sdk
Last synced: about 1 month ago
JSON representation
Mailjet plugin for CakePHP. Allows sending emails via Mailjet by using the provided Mailjet SDK.
- Host: GitHub
- URL: https://github.com/czepter/cake-mailjet
- Owner: czepter
- Created: 2019-04-18T19:34:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-11T08:15:17.000Z (over 2 years ago)
- Last Synced: 2024-12-24T16:08:25.402Z (about 1 year ago)
- Topics: cakephp, cakephp-plugin, cakephp3, mailer-class, mailjet, mailjet-sdk
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mailjet plugin for CakePHP
Allows sending emails via Mailjet by using the provided Mailjet SDK.
## Requirements
PHP >= 7.0
CakePHP >= 3.7
Composer
## Installation
You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).
The recommended way to install composer packages is:
```
composer require czepter/cake-mailjet
```
load this plugin into your src/AppController.php with:
```
bin/cake plugin load Mailjet
```
or modify the file by your own inside of bootstrap():
``` php
$this->addPlugin('Mailjet');
```
## Example configuration
example content of your config/app.php:
```php
'EmailTransport' => [
'default' => [
...
],
'mailjet' => [
'className' => 'Mailjet.Mailjet',
'apiKey' => 'your-api-key',
'apiSecret' => 'your-api-secret'
]
],
'Email' => [
'default' => [
'transport' => 'mailjet',
'from' => 'no-reply@example.org',
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
],
]
];
```
## Email setup
to write a mail using the templates use the following configuration in your Mailer class:
```php
$email
->emailFormat('html')
->subject('some text')
->to('hi@example.org')
->from('app@example.org')
->addHeaders([
'TemplateID' => 123456,
])
->setViewVars([
"greetings" => "a text wich replaces the var:greetings in your template",
...
])
->send();
```