Warning
This package is no longer necessary since Symfony created their own mailer for Scaleway TEM.
Please use this instead: Symfony Mailer - Scaleway
You can install the package via composer with following command:
composer require korridor/symfony-scaleway-tem-mailer
This package is tested for the following Laravel and PHP versions:
- 9.* (PHP 8.1)
Add the following code to the AppServiceProvider
:
use Korridor\SymfonyScalewayTemMailer\Transport\ScalewayApiTransport;
use Korridor\SymfonyScalewayTemMailer\Transport\ScalewaySmtpTransport;
// ..
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
{
// ...
Mail::extend('scaleway-api', function (array $config = []) {
return new ScalewayApiTransport($config['token'], $config['region'], $config['project_id']);
});
Mail::extend('scaleway-smtp', function (array $config = []) {
return new ScalewaySmtpTransport($config['token'], $config['region'], $config['project_id']);
});
}
Now add the following lines to the config/mail.php
file in the mailers
array:
'scaleway' => [
'transport' => 'scaleway-api',
'region' => env('MAIL_SCALEWAY_REGION', 'fr-par'),
'token' => env('MAIL_SCALEWAY_TOKEN'),
'project_id' => env('MAIL_SCALEWAY_PROJECT_ID'),
],
If you want to use the SMTP integration instead use following lines:
'scaleway' => [
'transport' => 'scaleway-smtp',
'region' => env('MAIL_SCALEWAY_REGION', 'fr-par'),
'token' => env('MAIL_SCALEWAY_TOKEN'),
'project_id' => env('MAIL_SCALEWAY_PROJECT_ID'),
],
Add the following lines to the config/services.yaml
file:
mailer.transport_factory.scaleway:
class: Korridor\SymfonyScalewayTemMailer\Transport\ScalewayTransportFactory
parent: mailer.transport_factory.abstract
tags:
- {name: mailer.transport_factory}
Then MAILER_DSN
environment variable for example like this:
MAILER_DSN=scaleway+api://SCW_PROJECT_ID:SCW_SECRET_KEY@api.scaleway.com
I am open for suggestions and contributions. Just create an issue or a pull request.
The docker
folder contains a local docker environment for development.
The docker workspace has composer and xdebug installed.
docker-compose run workspace bash
The composer test
command runs all tests with phpunit.
The composer test-coverage
command runs all tests with phpunit and creates a coverage report into the coverage
folder.
The composer fix
command formats the code with php-cs-fixer.
The composer lint
command checks the code with phpcs.
The structure of the repository is inspired by the project symfony/postmark-mailer.
This package is licensed under the MIT License (MIT). Please see license file for more information.