From 38cfd4412da2148a009deb410e855730355eacd5 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Thu, 21 Mar 2024 10:33:32 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=83=AB=E9=80=81=E4=BF=A1?= =?UTF-8?q?=E3=81=AEBCC=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Email/Sender.php | 9 +++++++-- config/mail.php | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Email/Sender.php b/app/Email/Sender.php index 3862fac..05ce395 100644 --- a/app/Email/Sender.php +++ b/app/Email/Sender.php @@ -21,9 +21,14 @@ class Sender 'mailer' => $email->type, ]); + $bcc = config('mail.bcc_targets', []); + try { - Mail::to($email->email) - ->send(new TextEmail($email->subject, $email->content, $email->emailAttachments)); + $send = Mail::to($email->email); + if (0 < count($bcc)) { + $send = $send->bcc($bcc); + } + $send->send(new TextEmail($email->subject, $email->content, $email->emailAttachments)); } catch (Exception $e) { Log::error("メール送信失敗", [ 'id' => $email->id, diff --git a/config/mail.php b/config/mail.php index 1bcc31c..609d6c2 100644 --- a/config/mail.php +++ b/config/mail.php @@ -125,4 +125,6 @@ return [ 'developmentEmail' => env('MAIL_ADDRESS_DEVELOPMENT'), + 'bcc_targets' => explode(",", env('MAIL_BCC_TARGETS', '')), + ];