diff --git a/integrations/nextcloud/snappymail/appinfo/info.xml b/integrations/nextcloud/snappymail/appinfo/info.xml
index 37068aa25..c539d78c3 100644
--- a/integrations/nextcloud/snappymail/appinfo/info.xml
+++ b/integrations/nextcloud/snappymail/appinfo/info.xml
@@ -86,4 +86,7 @@ There, click on the link to go to the SnappyMail admin panel.
OCA\SnappyMail\Migration\InstallStep
+
+ OCA\SnappyMail\Command\Settings
+
diff --git a/integrations/nextcloud/snappymail/lib/Command/Settings.php b/integrations/nextcloud/snappymail/lib/Command/Settings.php
new file mode 100644
index 000000000..f1ccbf4f6
--- /dev/null
+++ b/integrations/nextcloud/snappymail/lib/Command/Settings.php
@@ -0,0 +1,64 @@
+userManager = $userManager;
+ $this->config = $config;
+ }
+
+ protected function configure() {
+ $this
+ ->setName('snappymail:settings')
+ ->setDescription('modifies configuration')
+ ->addArgument(
+ 'uid',
+ InputArgument::REQUIRED,
+ 'User ID used to login'
+ )
+ ->addArgument(
+ 'user',
+ InputArgument::REQUIRED,
+ 'The login username'
+ )
+ ->addArgument(
+ 'pass',
+ InputArgument::REQUIRED,
+ 'The login passphrase'
+ )
+ ;
+ }
+
+ protected function checkInput(InputInterface $input) {
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ $uid = $input->getArgument('uid');
+ if (!$this->userManager->userExists($uid)) {
+ $output->writeln('The user "' . $uid . '" does not exist.');
+ return 1;
+ }
+
+ $sEmail = $input->getArgument('user');
+ $this->config->setUserValue($uid, 'snappymail', 'snappymail-email', $sEmail);
+
+ $sPass = $input->getArgument('pass');
+ $sPass = ($sEmail && $sPass) ? SnappyMailHelper::encodePassword($sPass, \md5($sEmail)) : '';
+ $this->config->setUserValue($uid, 'snappymail', 'passphrase', $sPass);
+ return 0;
+ }
+}