From 426a652ff38ba25d165fcaf505cb4dac7b577ca4 Mon Sep 17 00:00:00 2001 From: Pascal Garber Date: Wed, 22 Aug 2018 20:15:33 +0200 Subject: [PATCH] Automatic account creation in Nextcloud Mail If the app Nextcloud Mail app is installed the user mail account should be added automatically to this app. This is already possible via the config.php. So the emails can be reached directly in nextcloud, like already the contacts and the calendar. see * https://github.com/nextcloud/mail * https://github.com/nextcloud/mail/blob/master/doc/admin.md#automatic-account-creation --- setup/owncloud.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/setup/owncloud.sh b/setup/owncloud.sh index 8a6c0a36..043e536a 100755 --- a/setup/owncloud.sh +++ b/setup/owncloud.sh @@ -329,6 +329,7 @@ fi # * We need to set the logdateformat to something that will work correctly with fail2ban # * mail_domain' needs to be set every time we run the setup. Making sure we are setting # the correct domain name if the domain is being change from the previous setup. +# * Automatically add e-mail accounts in nextcloud mail # Use PHP to read the settings file, modify it, and write out the new settings array. TIMEZONE=$(cat /etc/timezone) CONFIG_TEMP=$(/bin/mktemp) @@ -347,6 +348,18 @@ include("$STORAGE_ROOT/owncloud/config.php"); \$CONFIG['mail_domain'] = '$PRIMARY_HOSTNAME'; +\$CONFIG['app.mail.accounts.default'] = array( + 'email' => '%EMAIL%', + 'imapHost' => '$PRIMARY_HOSTNAME', + 'imapPort' => 993, + 'imapUser' => '%EMAIL%', + 'imapSslMode' => 'ssl', + 'smtpHost' => '$PRIMARY_HOSTNAME', + 'smtpPort' => 587, + 'smtpUser' => '%EMAIL%', + 'smtpSslMode' => 'tls', +); + echo "