Skip to content

Commit

Permalink
adozione di scaleway per invio email
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed Jan 22, 2024
1 parent a967303 commit 3d93fcd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
12 changes: 11 additions & 1 deletion code/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Database\Eloquent\Model;

use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
use Symfony\Component\Mailer\Bridge\Scaleway\Transport\ScalewayTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;

use App\Category;
Expand All @@ -20,13 +21,22 @@ public function boot()
Schema::defaultStringLength(191);
// Model::preventLazyLoading();

if (env('MAIL_MAILER') == 'sendinblue') {
$mailer = env('MAIL_MAILER');

if ($mailer == 'sendinblue') {
Mail::extend('sendinblue', function () {
return (new SendinblueTransportFactory)->create(
new Dsn('sendinblue+api', 'default', config('services.sendinblue.key'))
);
});
}
else if ($mailer == 'scaleway') {
Mail::extend('scaleway', function () {
return (new ScalewayTransportFactory)->create(
new Dsn('scaleway+api', 'default', config('mail.mailers.scaleway.username'), config('mail.mailers.scaleway.password'))
);
});
}

/*
Questa va usata solo per una Collection di BookedProductVariant,
Expand Down
1 change: 1 addition & 0 deletions code/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"spatie/db-dumper": "^3.0",
"symfony/http-client": "^6.2",
"symfony/psr-http-message-bridge": "^2.1",
"symfony/scaleway-mailer": "^7.0",
"symfony/sendinblue-mailer": "^6.2",
"zetacomponents/archive": "dev-master"
},
Expand Down
8 changes: 7 additions & 1 deletion code/config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
|
*/

'default' => env('MAIL_MAILER', 'sendinblue'),
'default' => env('MAIL_MAILER', 'scaleway'),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -54,6 +54,12 @@
'transport' => 'sendinblue',
],

'scaleway' => [
'transport' => 'scaleway',
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
],

'mailgun' => [
'transport' => 'mailgun',
],
Expand Down

0 comments on commit 3d93fcd

Please sign in to comment.