beebmx / kirby-email-plus
Kirby Email Plus extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Fund package maintenance!
beebmx
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:kirby-plugin
pkg:composer/beebmx/kirby-email-plus
Requires
- php: ^8.3
- getkirby/composer-installer: ^1.0
Requires (Dev)
- getkirby/cms: ^5.1
- laravel/pint: ^1.0
- mailgun/mailgun-php: ^4.3
- nyholm/psr7: ^1.8
- pestphp/pest: ^4.1
- resend/resend-php: ^1.0
- spatie/ray: ^1.0
- symfony/http-client: ^7.3
Suggests
- nyholm/psr7: Required to enable support for the Mailgun mail.
- resend/resend-php: Required to enable support for the Resend mail.
- symfony/http-client: Required to enable support for the Mailgun mail.
- symfony/mailgun-mailer: Required to enable support for the Mailgun mail.
README
Email Plus for Kirby
Kirby has a built-in email engine with support for mail and smtp transports.
However, sometimes you may need more support for other email services like Mailgun or Resend.
Kirby Email Plus extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Overview
Installation
composer require beebmx/kirby-email-plus
Additionally to installing the Email Plus plugin, you need to install the email service package you want to use.
Mailgun installation
To use Mailgun as your email transport, you need to install the mailgun/mailgun-php package:
composer require mailgun/mailgun-php symfony/http-client nyholm/psr7
Resend installation
To use Resend as your email transport, you need to install the resend/resend-php package:
composer require resend/resend-php
Usage
With Kirby Email Plus you can choose between the built-in Kirby email transports (mail and smtp) and the new ones added by this plugin (mailgun and resend).
First you need to configure the email transport you want to use in your config.php file:
return [ 'beebmx.email-plus' => [ 'type' => 'resend', 'resend.key' => 're_XXXXXXXXXXXXXXXX', ], ];
Then, you can send emails using the Kirby email API as usual:
$kirby->email([ 'from' => 'welcome@supercompany.com', 'replyTo' => 'no-reply@supercompany.com', 'to' => 'someone@gmail.com', 'cc' => 'anotherone@gmail.com', 'bcc' => 'secret@gmail.com', 'subject' => 'Welcome!', 'body' => 'It\'s great to have you with us', ]);
For convinience, you can also set the type directly in the transport configuration:
return [ 'email' => [ 'transport' => [ 'type' => 'resend', ], ], 'beebmx.email-plus.resend.key' => 're_XXXXXXXXXXXXXXXX', ];
Options
| Option | Type | Default | Description |
|---|---|---|---|
| beebmx.email-plus.type | string |
null | Define the email transport mailgun or resend |
| beebmx.email-plus.mailgun.domain | string |
null | Define your mailgun domain to send emails. |
| beebmx.email-plus.mailgun.endpoint | string |
https://api.mailgun.net | https://api.eu.mailgun.net for EU servers. |
| beebmx.email-plus.mailgun.key | string |
null | Define your API Key for mailgun |
| beebmx.email-plus.resend.key | string |
null | Define your API Key for resend |
Here's an example of a full use of the options from the config.php file:
return [ 'beebmx.email-plus' => [ 'type' => 'resend', // mailgun or resend 'mailgun' => [ 'domain' => 'example.com', 'endpoint' => 'https://api.mailgun.net', 'key' => 'key-XXXXXXXXXXXXXXXX', ], 'resend' => [ 'key' => 're_XXXXXXXXXXXXXXXX', ], ], ];
License
Licensed under the MIT.
Credits
- Fernando Gutierrez @beebmx
- All Contributors
