Auto-Submitted mail header added

Auto-Submitted header should be added to every mail sent by an automatic system, such as CRON jobs, etc. Auto-Reply systems should NOT reply when this header is set to 'auto-generated'.
This commit is contained in:
slater0013 2021-05-28 11:08:05 +02:00 committed by GitHub
parent 11900c741e
commit 199fce8038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -188,6 +188,10 @@ class Mailer implements IMailer {
if (empty($message->getFrom())) { if (empty($message->getFrom())) {
$message->setFrom([\OCP\Util::getDefaultEmailAddress('no-reply') => $this->defaults->getName()]); $message->setFrom([\OCP\Util::getDefaultEmailAddress('no-reply') => $this->defaults->getName()]);
} }
// Add Auto-Submitted mail header. 'auto-generated' value should be set when email is sent by a script such as CRON jobs, etc.
$headers = $message->getSwiftMessage()->getHeaders();
$headers->addTextHeader('Auto-Submitted', 'auto-generated');
$failedRecipients = []; $failedRecipients = [];