Compare commits

...

5 commits

Author SHA1 Message Date
8d72ff121f
add mailjet config 2026-05-11 10:38:28 +03:00
0f3b1b560d
add frontend url to config 2026-05-11 10:38:19 +03:00
ee675b8e76
install mailjet sdk 2026-05-11 10:38:11 +03:00
2902addc76
bind mailjet mailer to emailer 2026-05-11 10:37:54 +03:00
d726da1e04
add mailjet mailer 2026-05-11 10:37:45 +03:00
6 changed files with 222 additions and 5 deletions

View file

@ -0,0 +1,36 @@
<?php
namespace App\Email;
use Mailjet\Client;
use Mailjet\Resources;
class MailjetMailer implements Emailer
{
public function __construct(
private Client $mailjet,
private string $fromName,
) {}
public function send(string $from, string $to, string $body): void
{
$this->mailjet->post(Resources::$Email, [
'body' => [
'Messages' => [
[
'From' => [
'Email' => $from,
'Name' => $this->fromName,
],
'To' => [
[
'Email' => $to,
],
],
'Subject' => 'TIDE',
'TextPart' => $body,
],
],
],
]);
}
}

View file

@ -12,11 +12,12 @@ use App\Email\EmailConfirmationToken\EmailConfirmationTokenRepository;
use App\Email\Emailer; use App\Email\Emailer;
use App\Email\EmailFactory; use App\Email\EmailFactory;
use App\Email\LaravelEmailFactory; use App\Email\LaravelEmailFactory;
use App\Email\LaravelMailer; use App\Email\MailjetMailer;
use App\User\UseCases\SignupUser\SignupUser; use App\User\UseCases\SignupUser\SignupUser;
use App\User\UserRepository; use App\User\UserRepository;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Mailjet\Client;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -25,7 +26,17 @@ class AppServiceProvider extends ServiceProvider
$this->app->bind(Clock::class, SystemClock::class); $this->app->bind(Clock::class, SystemClock::class);
$this->app->bind(TokenGenerator::class, RandomTokenGenerator::class); $this->app->bind(TokenGenerator::class, RandomTokenGenerator::class);
$this->app->bind(PasswordHasher::class, BcryptPasswordHasher::class); $this->app->bind(PasswordHasher::class, BcryptPasswordHasher::class);
$this->app->bind(Emailer::class, LaravelMailer::class); $this->app->bind(Emailer::class, function (Application $app) {
return new MailjetMailer(
mailjet: new Client(
config('services.mailjet.key'),
config('services.mailjet.secret'),
true,
['version' => 'v3.1'],
),
fromName: config('mail.from.name'),
);
});
$this->app->bind( $this->app->bind(
EmailFactory::class, EmailFactory::class,
function () { function () {

View file

@ -8,7 +8,8 @@
"require": { "require": {
"php": "^8.4", "php": "^8.4",
"laravel/framework": "^12.0", "laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1" "laravel/tinker": "^2.10.1",
"mailjet/mailjet-apiv3-php": "^1.6"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-ide-helper": "^3.7", "barryvdh/laravel-ide-helper": "^3.7",

167
backend/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "2444476efd69100b99a6fdd87c19a200", "content-hash": "3dbd75f32e2817f5cb61bd672fb6ae1f",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -2020,6 +2020,67 @@
], ],
"time": "2026-03-08T20:05:35+00:00" "time": "2026-03-08T20:05:35+00:00"
}, },
{
"name": "mailjet/mailjet-apiv3-php",
"version": "v1.6.6",
"source": {
"type": "git",
"url": "https://github.com/mailjet/mailjet-apiv3-php.git",
"reference": "9d5cea25f347719d7df7909fb4a43a72bd4e5011"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mailjet/mailjet-apiv3-php/zipball/9d5cea25f347719d7df7909fb4a43a72bd4e5011",
"reference": "9d5cea25f347719d7df7909fb4a43a72bd4e5011",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/guzzle": "^7.4.4",
"php": "^8.1",
"psr/http-client": "^1.0",
"symfony/validator": "^6.3|^7.0"
},
"require-dev": {
"mockery/mockery": "^1.4",
"php-coveralls/php-coveralls": "^2.0",
"phpcompatibility/php-compatibility": "*",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.4.0",
"squizlabs/php_codesniffer": "*"
},
"type": "library",
"autoload": {
"psr-0": {
"Mailjet": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mailjet",
"email": "dev@mailjet.com",
"homepage": "https://dev.mailjet.com"
}
],
"description": "PHP wrapper for the Mailjet API",
"homepage": "https://github.com/mailjet/mailjet-apiv3-php/",
"keywords": [
"Mailjet",
"api",
"email",
"php",
"v3"
],
"support": {
"issues": "https://github.com/mailjet/mailjet-apiv3-php/issues",
"source": "https://github.com/mailjet/mailjet-apiv3-php/tree/v1.6.6"
},
"time": "2025-12-24T15:55:48+00:00"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "3.10.0", "version": "3.10.0",
@ -5700,6 +5761,110 @@
], ],
"time": "2026-04-30T15:19:22+00:00" "time": "2026-04-30T15:19:22+00:00"
}, },
{
"name": "symfony/validator",
"version": "v7.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/validator.git",
"reference": "c76458623af9a3fe3b2e5b09b36453f334c2a361"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/c76458623af9a3fe3b2e5b09b36453f334c2a361",
"reference": "c76458623af9a3fe3b2e5b09b36453f334c2a361",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php83": "^1.27",
"symfony/translation-contracts": "^2.5|^3"
},
"conflict": {
"doctrine/lexer": "<1.1",
"symfony/dependency-injection": "<6.4",
"symfony/doctrine-bridge": "<7.0",
"symfony/expression-language": "<6.4",
"symfony/http-kernel": "<6.4",
"symfony/intl": "<6.4",
"symfony/property-info": "<6.4",
"symfony/translation": "<6.4.3|>=7.0,<7.0.3",
"symfony/var-exporter": "<6.4.25|>=7.0,<7.3.3",
"symfony/yaml": "<6.4"
},
"require-dev": {
"egulias/email-validator": "^2.1.10|^3|^4",
"symfony/cache": "^6.4|^7.0|^8.0",
"symfony/config": "^6.4|^7.0|^8.0",
"symfony/console": "^6.4|^7.0|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
"symfony/expression-language": "^6.4|^7.0|^8.0",
"symfony/finder": "^6.4|^7.0|^8.0",
"symfony/http-client": "^6.4|^7.0|^8.0",
"symfony/http-foundation": "^6.4|^7.0|^8.0",
"symfony/http-kernel": "^6.4|^7.0|^8.0",
"symfony/intl": "^6.4|^7.0|^8.0",
"symfony/mime": "^6.4|^7.0|^8.0",
"symfony/process": "^6.4|^7.0|^8.0",
"symfony/property-access": "^6.4|^7.0|^8.0",
"symfony/property-info": "^6.4|^7.0|^8.0",
"symfony/string": "^6.4|^7.0|^8.0",
"symfony/translation": "^6.4.3|^7.0.3|^8.0",
"symfony/type-info": "^7.1.8",
"symfony/yaml": "^6.4|^7.0|^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Validator\\": ""
},
"exclude-from-classmap": [
"/Tests/",
"/Resources/bin/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides tools to validate values",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/validator/tree/v7.4.10"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-05-05T15:30:56+00:00"
},
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v7.4.8", "version": "v7.4.8",

View file

@ -14,7 +14,7 @@ return [
*/ */
'name' => env('APP_NAME', 'Laravel'), 'name' => env('APP_NAME', 'Laravel'),
'frontend_url' => env('FRONTEND_URL', 'https://tide.yisroelbaum.com'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Environment | Application Environment

View file

@ -13,6 +13,10 @@ return [
| a conventional file to locate the various service credentials. | a conventional file to locate the various service credentials.
| |
*/ */
'mailjet' => [
'key' => env('MAILJET_API_KEY'),
'secret' => env('MAILJET_SECRET_KEY'),
],
'postmark' => [ 'postmark' => [
'key' => env('POSTMARK_API_KEY'), 'key' => env('POSTMARK_API_KEY'),