Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

add resend as mailer

Andras Bacsaia3f3470137e2
diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.php
index 638939589d..b412bebd65 100644
--- a/app/Notifications/Channels/EmailChannel.php
+++ b/app/Notifications/Channels/EmailChannel.php
@@ -6,13 +6,13 @@ use Exception;
use Illuminate\Mail\Message;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Mail;
+use Illuminate\Support\Str;
class EmailChannel
{
public function send(SendsEmail $notifiable, Notification $notification): void
{
$this->bootConfigs($notifiable);
- ray($notification);
$recepients = $notifiable->getRecepients($notification);
if (count($recepients) === 0) {
@@ -39,16 +39,21 @@ class EmailChannel
$password = data_get($notifiable, 'smtp_password');
if ($password) $password = decrypt($password);
- config()->set('mail.default', 'smtp');
- config()->set('mail.mailers.smtp', [
- "transport" => "smtp",
- "host" => data_get($notifiable, 'smtp_host'),
- "port" => data_get($notifiable, 'smtp_port'),
- "encryption" => data_get($notifiable, 'smtp_encryption'),
- "username" => data_get($notifiable, 'smtp_username'),
- "password" => $password,
- "timeout" => data_get($notifiable, 'smtp_timeout'),
- "local_domain" => null,
- ]);
+ if (Str::contains(data_get($notifiable, 'smtp_host'),'resend.com')) {
+ config()->set('mail.default', 'resend');
+ config()->set('resend.api_key', $password);
+ } else {
+ config()->set('mail.default', 'smtp');
+ config()->set('mail.mailers.smtp', [
+ "transport" => "smtp",
+ "host" => data_get($notifiable, 'smtp_host'),
+ "port" => data_get($notifiable, 'smtp_port'),
+ "encryption" => data_get($notifiable, 'smtp_encryption'),
+ "username" => data_get($notifiable, 'smtp_username'),
+ "password" => $password,
+ "timeout" => data_get($notifiable, 'smtp_timeout'),
+ "local_domain" => null,
+ ]);
+ }
}
}
diff --git a/composer.json b/composer.json
index 7fcdd9e265..c43f5d09c1 100644
--- a/composer.json
+++ b/composer.json
@@ -24,6 +24,7 @@
"masmerise/livewire-toaster": "^1.2",
"nubs/random-name-generator": "^2.2",
"poliander/cron": "^3.0",
+ "resend/resend-laravel": "^0.5.0",
"sentry/sentry-laravel": "^3.4",
"spatie/laravel-activitylog": "^4.7.3",
"spatie/laravel-data": "^3.4.3",
diff --git a/composer.lock b/composer.lock
index 45671727a3..a64169d6ef 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "0c023bed552776ee5e4eeda1ff0a5e19",
+ "content-hash": "15eb89e93c667bb63f48ef548ed38bed",
"packages": [
{
"name": "aws/aws-crt-php",
@@ -5404,6 +5404,131 @@
],
"time": "2023-04-15T23:01:58+00:00"
},
+ {
+ "name": "resend/resend-laravel",
+ "version": "v0.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/resendlabs/resend-laravel.git",
+ "reference": "e598d1e25e49a7aa4c35f653d1d828f69ee4fc1d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/resendlabs/resend-laravel/zipball/e598d1e25e49a7aa4c35f653d1d828f69ee4fc1d",
+ "reference": "e598d1e25e49a7aa4c35f653d1d828f69ee4fc1d",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/support": "^9.21|^10.0",
+ "php": "^8.1",
+ "resend/resend-php": "^0.7.1",
+ "symfony/mailer": "^6.2"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.14",
+ "mockery/mockery": "^1.5",
+ "orchestra/testbench": "^7.22|^8.0",
+ "pestphp/pest": "^1.22"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.x-dev"
+ },
+ "laravel": {
+ "providers": [
+ "Resend\\Laravel\\ResendServiceProvider"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Resend\\Laravel\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Resend and contributors",
+ "homepage": "https://github.com/resendlabs/resend-laravel/contributors"
+ }
+ ],
+ "description": "Resend for Laravel",
+ "homepage": "https://resend.com/",
+ "keywords": [
+ "api",
+ "client",
+ "laravel",
+ "php",
+ "resend",
+ "sdk"
+ ],
+ "support": {
+ "issues": "https://github.com/resendlabs/resend-laravel/issues",
+ "source": "https://github.com/resendlabs/resend-laravel/tree/v0.5.0"
+ },
+ "time": "2023-07-15T17:56:14+00:00"
+ },
+ {
+ "name": "resend/resend-php",
+ "version": "v0.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/resendlabs/resend-php.git",
+ "reference": "3b2e2eae0ded191b2ea67d0ee2e87cdc442316a0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/resendlabs/resend-php/zipball/3b2e2eae0ded191b2ea67d0ee2e87cdc442316a0",
+ "reference": "3b2e2eae0ded191b2ea67d0ee2e87cdc442316a0",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/guzzle": "^7.5",
+ "php": "^8.1.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.13",
+ "pestphp/pest": "^2.0",
+ "pestphp/pest-plugin-mock": "^2.0"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/Resend.php"
+ ],
+ "psr-4": {
+ "Resend\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Resend and contributors",
+ "homepage": "https://github.com/resendlabs/resend-php/contributors"
+ }
+ ],
+ "description": "Resend PHP library.",
+ "homepage": "https://resend.com/",
+ "keywords": [
+ "api",
+ "client",
+ "php",
+ "resend",
+ "sdk"
+ ],
+ "support": {
+ "issues": "https://github.com/resendlabs/resend-php/issues",
+ "source": "https://github.com/resendlabs/resend-php/tree/v0.7.1"
+ },
+ "time": "2023-07-12T07:08:27+00:00"
+ },
{
"name": "sentry/sdk",
"version": "3.5.0",
diff --git a/config/mail.php b/config/mail.php
index 4c63daf4fc..ec2125fabc 100644
--- a/config/mail.php
+++ b/config/mail.php
@@ -44,7 +44,9 @@ return [
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
-
+ 'resend'=> [
+ 'transport' => 'resend'
+ ],
'ses' => [
'transport' => 'ses',
],