Skip to content

Commit

Permalink
Add configuration for CC addresses in Contact Form (#1777)
Browse files Browse the repository at this point in the history
This is a necessity in part because the `@smrealms.de` mailbox is
overwhelmed with spam. But even if it weren't, this would allow for more
prompt responses to submissions (e.g. CC'ing a personal email address
that is monitored much more frequently than the official mailbox).
  • Loading branch information
hemberger authored Feb 4, 2024
1 parent 3093336 commit 9e15a70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/config.specific.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
// E-mail addresses to receive bug reports
const BUG_REPORT_TO_ADDRESSES = [];

// E-mail addresses to CC on contact form submissions
const CONTACT_FORM_CC_ADDRESSES = [];

//const HISTORY_DATABASES = [
// 'smr_classic_history' => 'old_account_id',
// 'smr_12_history' => 'old_account_id2',
Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parameters:

dynamicConstantNames:
- BUG_REPORT_TO_ADDRESSES
- CONTACT_FORM_CC_ADDRESSES
- ENABLE_BETA
- ENABLE_DEBUG
- ENABLE_LIBXML_ERRORS
Expand Down Expand Up @@ -92,6 +93,11 @@ parameters:
paths:
- src/bootstrap.php
- src/pages/Account/BugReportProcessor.php
-
# https://github.com/phpstan/phpstan/issues/7520
message: '#Empty array passed to foreach.#'
path: src/pages/Account/ContactFormProcessor.php
count: 1
-
# https://github.com/thephpleague/oauth2-client/issues/897
message: '#Parameter \#1 \$token of method .*::getResourceOwner\(\) expects .*AccessToken, .*AccessTokenInterface given.#'
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Account/ContactFormProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public function build(Account $account): never {
'Account ID:' . EOL . '-----------' . EOL . $account->getAccountID() . EOL . EOL .
'Message:' . EOL . '------------' . EOL . $msg;
$mail->addAddress($receiver);
foreach (CONTACT_FORM_CC_ADDRESSES as $ccAddress) {
$mail->addCC($ccAddress);
}
$mail->send();

$message = 'Your message has been successfully submitted!';
Expand Down

0 comments on commit 9e15a70

Please sign in to comment.