Emails not being received (or maybe not being sent?)

Hi all,

I have a VPS hosting:

  • a Wordpress website at mywebsite.com

  • a Nextcloud server at mynextcloud.com/nc

  • OS: Ubuntu 16.04.5 LTS

  • Nextcloud version: 13.0.5.2

  • Server version: Apache/2.4.18

  • PHP version: 7.0.30

  • MySQL version: 5.7.23

When logged in as an admin user I can see under Additional Settings the email server settings. These plus the linked documentation on email look simple, but I can’t manage to confirm it’s working.

There won’t be much need for emails but I want them to work if needed. I’d prefer not to use the SMTP option as I don’t want my email login details sitting on the server.

I’ve input a working email address into the admin profile. In the email server settings, I’ve selected PHP and input a From address. I’ve used both a working and a non-existent From address but neither seems to work. I assume the From is not critical to the sending functionality.

If I test it with the Send Email button it appears to work, it confirms Email sent. However no email arrives. I’ve tested the destination address and it works. The same issue happens if I select Sendmail in the options rather than PHP.

The server has sendmail installed and using the contact form on the website of my other domain hosted on the VPS, which uses sendmail, the emails always get through.

I’ve checked the error.log and nothing specific appears there when using the email test.

In the activity log, these entries appear around the time I try to send a test email (IP address removed):

xx.xxx.xxx.xx - - [08/Aug/2018:11:16:23 +0000] "GET /nc/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 1372 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36"

xx.xxx.xxx.xx - - [08/Aug/2018:11:16:44 +0000] "POST /nc/settings/admin/mailtest HTTP/1.1" 200 1108 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36"

xx.xxx.xxx.xx - - [08/Aug/2018:11:16:53 +0000] "GET /nc/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 1372 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36"

config.php file

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'mynextcloud.com',
  ),
  'datadirectory' => '/var/www/mynextcloud/nc/data',
  'overwrite.cli.url' => 'https://mynextcloud.com/nc',
  'dbtype' => 'mysql',
  'version' => '13.0.5.2',
  'dbname' => 'mydb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'mydbusr',
  'dbpassword' => 'xxxxxxxxxxxxxxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'htaccess.RewriteBase' => '/nc',
  'mail_from_address' => 'xxxxxx',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'xxxxxxxxx',
);

Any suggestions on how to get this working?

thanks!

Today I upgraded my server and now have the current setup:

  • OS: Ubuntu 18.04.1 LTS

  • Nextcloud version: 13.0.5

  • Server version: Apache/2.4.29

  • PHP version: PHP 7.2.7

  • MySQL version: 14.14 distrib 5.7.23

I still cannot get the server to send a test email from Nextcloud.

Again, when I try to send a test email, the green “email sent” confirmation appears.

nothing is written to the error.log

the access.log has entries such as these (which includes lines showing where I’m switching the email “send mode” option to see if PHP or Sendmail will work:

81.187.230.88 - - [17/Aug/2018:15:26:03 +0000] "POST /nc/settings/admin/mailtest HTTP/1.1" 200 918 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
81.187.230.88 - - [17/Aug/2018:15:27:16 +0000] "POST /nc/settings/admin/mailsettings HTTP/1.1" 200 918 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
81.187.230.88 - - [17/Aug/2018:15:27:26 +0000] "POST /nc/settings/admin/mailtest HTTP/1.1" 200 918 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
81.187.230.88 - - [17/Aug/2018:15:27:53 +0000] "POST /nc/settings/admin/mailsettings HTTP/1.1" 200 1067 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
81.187.230.88 - - [17/Aug/2018:15:30:54 +0000] "POST /nc/settings/admin/mailsettings HTTP/1.1" 200 918 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
81.187.230.88 - - [17/Aug/2018:15:30:57 +0000] "POST /nc/settings/admin/mailtest HTTP/1.1" 200 918 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"

anonymised config.php is as follows:

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'mynextcloud.com',
  ),
  'datadirectory' => '/var/www/mynextcloud/nc/data',
  'overwrite.cli.url' => 'https://mynextcloud.com/nc',
  'dbtype' => 'mysql',
  'version' => '13.0.5.2',
  'dbname' => 'mydb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'mydbusr',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'htaccess.RewriteBase' => '/nc',
  'mail_from_address' => 'ncadmin',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'xxxxxxxxxxxxx',
);

Any advice gratefully received!

For example, do I need to open any incoming ports in the firewall?

Thanks!

Is there any more info I can provide that might allow someone to offer a solution?