Skip to content

Add Resend mailer support#2

Merged
stijnwtf merged 1 commit into
realm/developfrom
feat/resend-mailer-support
May 30, 2026
Merged

Add Resend mailer support#2
stijnwtf merged 1 commit into
realm/developfrom
feat/resend-mailer-support

Conversation

@stijnwtf

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 30, 2026 16:14
@stijnwtf
stijnwtf merged commit 084cfa9 into realm/develop May 30, 2026
0 of 9 checks passed
@stijnwtf
stijnwtf deleted the feat/resend-mailer-support branch May 30, 2026 16:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Resend as a supported mail transport for the Panel. Wires Resend into Laravel's mail/service configs, extends the p:environment:mail artisan command with a --resend-key option and dispatch path, surfaces a Resend-specific note on the SMTP-only admin mail settings page, and adds integration tests covering the new selection flow.

Changes:

  • Register the resend mailer in config/mail.php, add services.resend.key, declare resend/resend-php in composer.json, and document RESEND_KEY in .env.example.
  • Add a setupResendDriverVariables() branch (plus translation key and choice entry) in EmailSettingsCommand, and add a from-address presence check.
  • Add new integration tests for the command and a Resend hint to the admin mail settings disabled-state view.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
config/mail.php Registers the resend mailer entry and updates the supported-list comment.
composer.json Adds resend/resend-php ^0.10.0 runtime dependency.
.env.example Documents the new RESEND_KEY variable.
app/Console/Commands/Environment/EmailSettingsCommand.php Adds Resend choice, --resend-key option, Resend setup method, and a from-address validation.
resources/lang/en/command/messages.php Adds ask_resend_key prompt translation.
resources/views/admin/settings/mail.blade.php Shows a Resend-specific note when mail.default === 'resend'.
tests/Integration/Commands/Environment/EmailSettingsCommandTest.php New integration tests for SMTP/Resend selection and from-address validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

*/
private function setupResendDriverVariables()
{
$this->variables['MAIL_DRIVER'] = 'resend';
Comment on lines +14 to +66
$this->artisan('p:environment:mail', [
'--driver' => 'smtp',
'--host' => 'smtp.test.com',
'--port' => '587',
'--username' => 'user@test.com',
'--password' => 'secret',
'--encryption' => 'tls',
'--email' => 'panel@test.com',
'--from' => 'Test Panel',
])->assertExitCode(0);

// Verify the .env file was updated
$env = file_get_contents(base_path('.env'));
$this->assertStringContainsString('MAIL_DRIVER=smtp', $env);
$this->assertStringContainsString('MAIL_HOST=smtp.test.com', $env);
$this->assertStringContainsString('MAIL_PORT=587', $env);
$this->assertStringContainsString('MAIL_FROM_ADDRESS=panel@test.com', $env);
}

/**
* Test that the Resend driver can be selected and configured.
*/
public function test_resend_driver_selection(): void
{
$this->artisan('p:environment:mail', [
'--driver' => 'resend',
'--resend-key' => 're_test_123456789',
'--email' => 'panel@test.com',
'--from' => 'Test Panel',
])->assertExitCode(0);

$env = file_get_contents(base_path('.env'));
$this->assertStringContainsString('MAIL_DRIVER=resend', $env);
$this->assertStringContainsString('RESEND_KEY=re_test_123456789', $env);
$this->assertStringContainsString('MAIL_FROM_ADDRESS=panel@test.com', $env);
}

/**
* Test that the Resend driver shows an error when no key is provided.
*/
public function test_resend_driver_warns_without_key(): void
{
$this->artisan('p:environment:mail', [
'--driver' => 'resend',
'--resend-key' => '',
'--email' => 'panel@test.com',
'--from' => 'Test Panel',
])->assertExitCode(0);

// The command should still write the env (it warns but doesn't abort)
$env = file_get_contents(base_path('.env'));
$this->assertStringContainsString('MAIL_DRIVER=resend', $env);
}
Comment on lines +168 to +176
$this->variables['RESEND_KEY'] = $this->option('resend-key') ?? $this->ask(
trans('command/messages.environment.mail.ask_resend_key'),
$this->config->get('services.resend.key')
);

if (empty($this->variables['RESEND_KEY'])) {
$this->output->error('A Resend API key is required when using the Resend mail driver.');
$this->output->comment('You can obtain an API key at https://resend.com/api-keys');
}
Comment thread composer.json
"predis/predis": "^3.3.0",
"prologue/alerts": "^1.3.0",
"psr/cache": "^3.0.0",
"resend/resend-php": "^0.10.0",
Comment on lines +67 to +71
if (empty($this->variables['MAIL_FROM_ADDRESS'])) {
$this->output->error('A from address is required for sending emails.');

return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants