diff --git a/app/Ninja/Mailers/Mailer.php b/app/Ninja/Mailers/Mailer.php index d1aa10ec7c7e..b7c50bea8836 100644 --- a/app/Ninja/Mailers/Mailer.php +++ b/app/Ninja/Mailers/Mailer.php @@ -9,6 +9,12 @@ class Mailer { public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = []) { + // check the username is set + if ( ! env('POSTMARK_API_TOKEN') && ! env('MAIL_USERNAME')) { + return trans('texts.invalid_mail_config'); + } + + // don't send emails to dummy addresses if (stristr($toEmail, '@example.com')) { return true; } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 10e253be27b0..ba7fb23d8a20 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1032,4 +1032,7 @@ return array( 'color_font_help' => 'Note: the primary color and fonts are also used in the client portal and custom email designs.', 'live_preview' => 'Live Preview', + 'invalid_mail_config' => 'Unable to send email, please check that the mail settings are correct.', + + ); \ No newline at end of file