aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-01-04 09:34:14 +0100
committerGitHub <noreply@github.com>2023-01-04 09:34:14 +0100
commit348454cb91cd0f7e75e77ae9080237ebab31d66b (patch)
treed4bab3c4f3deb28dd3046c7adac264a7b5804062 /apps/settings
parentb37a4950e4b2c8cf79b59295a07d40e34afea423 (diff)
parentc8bde160cd2c40baffca71a45b77d62dda33e795 (diff)
downloadnextcloud-server-348454cb91cd0f7e75e77ae9080237ebab31d66b.tar.gz
nextcloud-server-348454cb91cd0f7e75e77ae9080237ebab31d66b.zip
Merge pull request #35876 from bennet0496/patch-mail-header
Adding option to set Auto-Submitted email header
Diffstat (limited to 'apps/settings')
-rw-r--r--apps/settings/lib/Mailer/NewUserMailHelper.php2
-rw-r--r--apps/settings/tests/Mailer/NewUserMailHelperTest.php5
2 files changed, 7 insertions, 0 deletions
diff --git a/apps/settings/lib/Mailer/NewUserMailHelper.php b/apps/settings/lib/Mailer/NewUserMailHelper.php
index 50502ed1d39..b91aea4391b 100644
--- a/apps/settings/lib/Mailer/NewUserMailHelper.php
+++ b/apps/settings/lib/Mailer/NewUserMailHelper.php
@@ -35,6 +35,7 @@ use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory;
+use OCP\Mail\Headers\AutoSubmitted;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\Security\ICrypto;
@@ -181,6 +182,7 @@ class NewUserMailHelper {
$message->setTo([$email => $user->getDisplayName()]);
$message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]);
$message->useTemplate($emailTemplate);
+ $message->setAutoSubmitted(AutoSubmitted::VALUE_AUTO_GENERATED);
$this->mailer->send($message);
}
}
diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php
index 252dcfd8057..5c7d182d436 100644
--- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php
+++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php
@@ -42,6 +42,7 @@ use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory;
+use OCP\Mail\Headers\AutoSubmitted;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\Security\ICrypto;
@@ -867,6 +868,10 @@ EOF;
->expects($this->once())
->method('useTemplate')
->with($emailTemplate);
+ $message
+ ->expects($this->once())
+ ->method('setAutoSubmitted')
+ ->with(AutoSubmitted::VALUE_AUTO_GENERATED);
$this->defaults
->expects($this->once())
->method('getName')