Nexcloud VM SMTP setup does not work

Hi,

I have just bought the Nextcloud VM [Pre-installed – 500 GB version from hanssonit.se.
But while installing I encountered an error or what seems to be a bug.
I’m unable to setup the email notification service.

While running “sudo bash /var/scripts/menu.sh” again and again(with different options) I always get the message:
smtprelaysetuperror

And using the webinterface there is no way to use or test it because there I also get an error message saying that i should enter an email address.
But it seems that a lot of software regarding email is not installed by the installer so that might not be the real problem.

Is this a bug?
Or should I do someting different?

I’m not getting an error message of any kind and can’t find one in the logs.

Any help would be appreciated.

Gr. Edo

@enoch85 How to help here?

I mean it seems like debugging is a bit hard if

  1. the logfile is commented: https://github.com/nextcloud/vm/blob/a4eb6a6ac44059c5a800d0b6f103ac15d1c6c1f2/addons/smtp-mail.sh#L162
  2. we remove the logfile if something went wrong: https://github.com/nextcloud/vm/blob/a4eb6a6ac44059c5a800d0b6f103ac15d1c6c1f2/addons/smtp-mail.sh#L253

So I guess 1. it should not be commented and 2. the logfile shouldn’t get removed if something fails.

BTW: is this still the case?

@szaimen

I didn’t have time to investigate the logging part yet.

Feel free to dig in to it. :rocket:

@provell The SMTP relay is outside of Nextcloud. everything happens in the OS, so there’s no GUI where you can reach it, and there’s no connection to the Nextcloud logs either.

I opened https://github.com/nextcloud/vm/pull/1536 for that :+1:

1 Like

@provell we just merged https://github.com/nextcloud/vm/pull/1536.
Please wait 10 minutes and try to run the setup again. If it still doesn’t work, you will find more debugging information in the /var/log/msmtp file.

Hi, thanks for the effort.

I updated the server using the /var/scripts/update.sh script to get the new software.
Then I ran the smpt setup again and unfortunatly got the same result that it failed.
The error message did say I could find out more about the failure in /var/log/msmtp so I am running the updated software.

But when I looked in to /var/log/msmtp the file was 0 in size and thus empty.

NOTE! Sending a test email using the settings menu in the GUI now works.
I deleted the admin user that had a email address as a username and created a “normal” username.
If this was realy the problem maybe catching the input of username and checking for @ could help in future versions.

Please let me know if I can do some more testing.
Thanks in advance for the help

Hey, could you please try one time again? I wonder why there is still nothing in the log dile but now there should be something in there :wink:

Ok, did another test:
sudo bash /var/scripts/setup.sh
sudo bash/var/scripts/menu.sh…and all the smpt setup info.

Then got the same error telling met to look in /var/log/msmtp
This time with content:
mail: /usr/bin/msmtp -t: No such file or directory
Can’t send mail: sendmail process failed with error code 1

I checked and there is indeed no such file or directory in /user/bin
Seems like I’m missing an executable file. Correct?

The question is why it is missing?!
I never encountered this problem…

Btw: It should get installed here: https://github.com/nextcloud/vm/blob/master/addons/smtp-mail.sh#L47-L48

Could you maybe post some information about your VM? Is this Ubuntu 20.04?

@enoch85 any idea?

Appart from why it is missing there is another question: How do I get it?
Currently I’m using the nextcloud server and would rather not do a complete re-install.

And information about my VM is here: https://shop.hanssonit.se/product/nextcloud-vm-500gb/
That’s the one I bought and currently using.

How do you get it is already answered by the link that I’ve send to you in my post above. Those commands should install those automatically.

But if it helps:
Run sudo apt install msmtp msmtp-mta mailutils
Afterwards check if the directory exists.
Would also be interesting to know if all packets get successfully installed.

The question is when did you buy the VM? Depending on this the VM will be on Ubuntu 18.04 or 20.04…

Again, the scripted smtp setup has nothing to do with the GUI based one (which is Nextclouds own implementation).

That’s not a valid script.

Basically, the menu.sh script will get you all the latest setup scripts, and the update script will get you the latest lib files and menu script.

There might have been a caching issue since Github probably use some cache to serve the files. So my suggestion would be to:

  1. Run the menu script and choose to “Update Nextcloud”
  2. Run the menu script again and choose to install the SMTP relay
  3. If that still doesn’t work, please report an issue on Github.

Thanks!