https://github.com/bertoost/craft-3-ssmtpmailer
A Craft 3 CMS mail adaptor for using sSMTP (a sendmail replacement)
https://github.com/bertoost/craft-3-ssmtpmailer
Last synced: about 1 year ago
JSON representation
A Craft 3 CMS mail adaptor for using sSMTP (a sendmail replacement)
- Host: GitHub
- URL: https://github.com/bertoost/craft-3-ssmtpmailer
- Owner: bertoost
- License: mit
- Created: 2018-09-18T10:46:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-28T20:29:59.000Z (over 3 years ago)
- Last Synced: 2025-03-02T05:55:48.347Z (over 1 year ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Craft CMS 3 - sSMTP Mailer
This mailer for Craft CMS 3 is a simple replacement for Sendmail, using sSMTP.
More information about sSMTP [can be found here](https://wiki.archlinux.org/index.php/SSMTP)
## Install plugin
Use the Craft Plugin Store or use composer
```bash
# go to the project directory
cd /path/to/my-project.test
# tell Composer to load the plugin
composer require bertoost/craft-ssmtpmailer
# OR only for development
# composer require bertoost/craft-ssmtpmailer --dev
# tell Craft to install the plugin
./craft install/plugin ssmtpmailer
```
## Executed command
This adaptor is using the Swiftmailer Sendmail Transport literally. It is extending it and just replaces the command to execute.
The next command is used for sSMTP to send your email.
```
/usr/sbin/ssmtp -t
```
## Configure it for development only
Since Craft 3, you can use multi-environment config in every single configuration file in your `config/` folder.
To setup this mailer only for dev-environment, you can change `config/app.php` in a multi-environment config and configure the sSMTP mailer for dev only.
```php
return [
// general for every environment
'*' => [
'modules' => [
// ...
],
'bootstrap' => [
// ...
],
],
// Staging environment settings
'staging' => [
// ...
],
// Dev environment settings
'dev' => [
'components' => [
'mailer' => function() {
// Get the stored email settings
$settings = Craft::$app->getSystemSettings()->getEmailSettings();
$settings->transportType = bertoost\ssmtpmailer\mail\Ssmtp::class;
$settings->transportSettings = [];
return craft\helpers\MailerHelper::createMailer($settings);
},
],
],
];
```