From 75d254a6a4efc907d7b3b7b8e2edd1a4a4354f9c Mon Sep 17 00:00:00 2001 From: Lukas <31182042+m0uka@users.noreply.github.com> Date: Sat, 5 Jun 2021 17:38:47 +0200 Subject: [PATCH] Add support for mailgun API endpoint (#3364) --- .env.example | 1 + app/Console/Commands/Environment/EmailSettingsCommand.php | 6 ++++++ config/services.php | 1 + resources/lang/en/command/messages.php | 1 + 4 files changed, 9 insertions(+) diff --git a/.env.example b/.env.example index 9e3ed600..72a0a764 100644 --- a/.env.example +++ b/.env.example @@ -25,6 +25,7 @@ MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=tls MAIL_FROM=no-reply@example.com +MAILGUN_ENDPOINT=api.mailgun.net # You should set this to your domain to prevent it defaulting to 'localhost', causing # mail servers such as Gmail to reject your mail. # diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index 6d98b63c..57998a2e 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -37,6 +37,7 @@ class EmailSettingsCommand extends Command {--encryption=} {--host=} {--port=} + {--endpoint=} {--username=} {--password=}'; @@ -140,6 +141,11 @@ class EmailSettingsCommand extends Command trans('command/messages.environment.mail.ask_mailgun_secret'), $this->config->get('services.mailgun.secret') ); + + $this->variables['MAILGUN_ENDPOINT'] = $this->option('endpoint') ?? $this->ask( + trans('command/messages.environment.mail.ask_mailgun_endpoint'), + $this->config->get('services.mailgun.endpoint') + ); } /** diff --git a/config/services.php b/config/services.php index be637e50..b15f7bf0 100644 --- a/config/services.php +++ b/config/services.php @@ -16,6 +16,7 @@ return [ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT') ], 'mandrill' => [ diff --git a/resources/lang/en/command/messages.php b/resources/lang/en/command/messages.php index e135a1ec..b02fa8c2 100644 --- a/resources/lang/en/command/messages.php +++ b/resources/lang/en/command/messages.php @@ -53,6 +53,7 @@ return [ 'ask_smtp_username' => 'SMTP Username', 'ask_smtp_password' => 'SMTP Password', 'ask_mailgun_domain' => 'Mailgun Domain', + 'ask_mailgun_endpoint' => 'Mailgun Endpoint', 'ask_mailgun_secret' => 'Mailgun Secret', 'ask_mandrill_secret' => 'Mandrill Secret', 'ask_postmark_username' => 'Postmark API Key',