Skip to content

Commit

Permalink
[FEATURE] Added noInterceptPatterns to be able to bypass interception…
Browse files Browse the repository at this point in the history
… for specific mail addresses or domains
  • Loading branch information
bweinzierl committed Mar 25, 2020
1 parent 169e1c6 commit 9e04b71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Classes/Aspect/DebuggingAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public function interceptEmails(\Neos\Flow\Aop\JoinPointInterface $joinPoint) {
$oldTo = $message->getTo();
$oldCc = $message->getCc();
$oldBcc = $message->getBcc();

foreach ($this->settings['interceptAll']['noInterceptPatterns'] as $pattern) {
if (preg_match($pattern, key($oldTo))) {
// let the mail through but clean all cc and bcc fields
$message->setCc(array());
$message->setBcc(array());
return;
}
}

$interceptedRecipients = key($oldTo) . ($oldCc ? ' CC: ' . key($oldCc) : '') . ($oldBcc ? ' BCC: ' . key($oldBcc) : '');
$message->setSubject('[intercepted '.$interceptedRecipients.'] '.$message->getSubject());

Expand Down
1 change: 1 addition & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FormatD:
interceptAll:
active: false
recipients: []
noInterceptPatterns: []
bccAll:
active: false
recipients: []
Expand Down

0 comments on commit 9e04b71

Please sign in to comment.