Skip to content

Commit

Permalink
Added an option to send a copy of all generated e-mails to a BCC address
Browse files Browse the repository at this point in the history
  • Loading branch information
hakakou committed Dec 8, 2020
1 parent 4d1205a commit ac224fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Core/Mail/Transport/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function sendEmail($recipientEmail, $recipientName, $subject, $html, $aut
->setFrom($this->helper->mail->getMailSenderAddress(), $authorName)
->setTo(array($recipientEmail => $recipientName));

if (! empty(MAIL_BCC)) {
$message->setBcc(MAIL_BCC);
}

$headers = $message->getHeaders();

// See https://tools.ietf.org/html/rfc3834#section-5
Expand Down
1 change: 1 addition & 0 deletions app/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
// Mail configuration
defined('MAIL_CONFIGURATION') or define('MAIL_CONFIGURATION', getenv('MAIL_CONFIGURATION') ? strtolower(getenv('MAIL_CONFIGURATION')) === 'true' : true);
defined('MAIL_FROM') or define('MAIL_FROM', getenv('MAIL_FROM') ?: '[email protected]');
defined('MAIL_BCC') or define('MAIL_BCC', getenv('MAIL_BCC') ?: '');
defined('MAIL_TRANSPORT') or define('MAIL_TRANSPORT', getenv('MAIL_TRANSPORT') ?: 'mail');
defined('MAIL_SMTP_HOSTNAME') or define('MAIL_SMTP_HOSTNAME', getenv('MAIL_SMTP_HOSTNAME') ?: '');
defined('MAIL_SMTP_PORT') or define('MAIL_SMTP_PORT', intval(getenv('MAIL_SMTP_PORT')) ?: 25);
Expand Down
3 changes: 3 additions & 0 deletions config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
// E-mail address used for the "From" header (notifications)
define('MAIL_FROM', '[email protected]');

// E-mail address used for the "Bcc" header to send a copy of all notifications
define('MAIL_BCC', '');

// Mail transport available: "smtp", "sendmail", "mail" (PHP mail function), "postmark", "mailgun", "sendgrid"
define('MAIL_TRANSPORT', 'mail');

Expand Down

0 comments on commit ac224fa

Please sign in to comment.