I can't get the Nextcloud Email Server settings to work with my ISP email account

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 27.1.5
Nextcloud AIO: v7.12.1
Operating system and version: Nixos 23.11
Apache or nginx version: Apache/2.4.58
PHP version : 8.1.27

The issue you are facing:

I can’t get the Nextcloud Email Server settings to work with my ISP email account. I have an e-mail account from my IPS which I have been using as an SMTP relay. My IPS is Shaw.ca: Setting up Shaw email. I have successfully used this account with msmtp to send me system notification, below is my msmtprc file:

defaults
aliases /etc/aliases
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account default
from username@shaw.ca
host smtp.shaw.ca
password Pa$$word
port 587
tls_starttls on
user username

I have never been able to get it to work with the Email Server setting under Basic Settings in Nextcloud.

Is this the first time you’ve seen this error?: N

I have had this issue for a few years now on a different installation of Nextcloud, and I am finally getting around to try and do something about it.

Steps to replicate it:

  1. Enter what I think would be the correct setting to use my IPS email server. I have tried many variations on what I think would be correct. Below is a screenshot of the current ones I am trying:
    image
  2. Click the Send email button
  3. Get the following error: A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)

The output of your Nextcloud log in Admin > Logging:

I did not see anything in the log related to this. Are there any suggestions on chagnes to be made to the logging setting to help with this?

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => 'Pa$$word',
    'port' => 6379,
  ),
  'overwritehost' => 'nextcloud.example.com',
  'overwriteprotocol' => 'https',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'nextcloud.example.com',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '27.1.5.1',
  'overwrite.cli.url' => 'https://nextcloud.example.com/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => 'DbPa$$word',
  'installed' => true,
  'instanceid' => 'oc2ylo56dq8t',
  'maintenance' => false,
  'loglevel' => '2',
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => '10485760',
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'enabledPreviewProviders' =>
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
  ),
  'enable_previews' => true,
  'upgrade.disable-web' => true,
  'mail_smtpmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 30',
  'activity_expire_days' => '30',
  'simpleSignUpLink.shown' => false,
  'share_folder' => '/Shared',
  'memories.exiftool' => '/var/www/html/custom_apps/memories/bin-ext/exiftool-amd64-musl',
  'memories.vod.path' => '/var/www/html/custom_apps/memories/bin-ext/go-vod-amd64',
  'memories.vod.ffmpeg' => '/usr/bin/ffmpeg',
  'memories.vod.ffprobe' => '/usr/bin/ffprobe',
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'upgrade.cli-upgrade-link' => 'https://github.com/nextcloud/all-in-one/discussions/2726',
  'updatedirectory' => '/nc-updater',
  'davstorage.request_timeout' => 3600,
  'htaccess.RewriteBase' => '/',
  'dbpersistent' => false,
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
  ),
  'default_phone_region' => 'CA',
  'skeletondirectory' => '',
  'mail_from_address' => 'username',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'shaw.ca',
  'mail_smtphost' => 'smtp.shaw.ca',
  'mail_smtpport' => '587',
  'mail_smtpauth' => '1',
  'mail_smtpname' => 'username',
  'mail_smtppassword' => 'Pa$$word',
  'memories.gis_type' => 2,
  'memories.vod.disable' => false,
  'memories.vod.vaapi' => true,
  'allow_local_remote_servers' => true,
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'user_oidc' =>
  array (
    'auto_provision' => false,
  ),
  'bulkupload.enabled' => false,
  'appsallowlist' =>
  array (
  ),
);

Try activating email debugging and see what the logs show:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html#troubleshooting

and you didn’t have to create an app password for that?

@Mark_F Not everyone is using Gmail :wink: Doesn’t seem to be necessary with that provider: How to set up your Shaw email

@Smith_oo4 I would first try increaseing the timeout…

"mail_smtptimeout" => 30,

…and if that doesn’t help, enable debug mode as @jtr has already suggested.

1 Like

Thank you for the suggestions

I tried increasing the time-out and this did not have any effect, same error.

I enabled debug mode and got the following:

[core] Debug: < 220 shw-obgw-4002a.ext.cloudfilter.net cmsmtp ESMTP server ready
> EHLO nextcloud.example.com
< 250-shw-obgw-4002a.ext.cloudfilter.net hello [68.146.132.242], pleased to meet you
< 250-AUTH LOGIN PLAIN
< 250-SIZE 30000000
< 250-8BITMIME
< 250-STARTTLS
< 250 OK
> STARTTLS
< 220 Ready to start TLS
> EHLO nextcloud.example.com
< 250-shw-obgw-4002a.ext.cloudfilter.net hello [68.146.132.242], pleased to meet you
< 250-AUTH LOGIN PLAIN
< 250-SIZE 30000000
< 250-8BITMIME
< 250 OK
> AUTH LOGIN
< 334 VXNlcm5hbWU6
> c21pdGhfb280
< 334 UGFzc3dvcmQ6
> Q2FIQHZNc0R2OFIyI2Z3
< 235 ... authentication succeeded
> MAIL FROM:<username@shaw.ca>
< 250 <username@shaw.ca> sender ok
> RCPT TO:<username@gmail.com>
< 250 <username@gmail.com> recipient ok
> DATA
< 354 OK
> .
< 550 <username@shaw.ca> message rejected. AUP#SNDR


POST /settings/admin/mailtest
from 172.18.0.1 by admin at 2024-02-29T19:54:09+00:00

[no app in context] Debug: Email transport "Symfony\Component\Mailer\Transport\Smtp\SmtpTransport" stopping

POST /settings/admin/mailtest
from 172.18.0.1 by admin at 2024-02-29T19:54:09+00:00

Any suggestions?

Thank you

It looks like your provider is blocking the message.

AUP stands for “Acceptable Use Policy” and SNDR means “Sender related issue”.

Or in simple terms, your email provider is classifying the message as spam.

1 Like

That is annoying, and I probably have no way to change this with the ISP.

Maybe I should be looking for a different e-mail. Is Gmail a good recommendation?

Thank you