Error sending New User Emails

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 (eg, 20.0.5): 25.0.3
Operating system and version : Ubuntu Server 22.10
Apache or nginx version : Apache 2.4.52
PHP version (eg, 7.4): 8.0.27

The issue you are facing:
Unable to send new user E-mails w/ error “An error occurred during the request, unable to proceed”

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Create New user, system will auto generate new e-mail - Get error
  2. Use User panel to resend Welcome email to user, get error

The output of your Nextcloud log in Admin > Logging:

https://pastebin.com/XRga2P2G

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

https://pastebin.com/bY502qXr

The output of your Apache/nginx/system log in /var/log/____:

sh: 1: /var/www/nextcloud/apps/mail/vendor/christophwurst/kitinerary-bin/src/../bin/kitinerary-extractor: Permission denied
sh: 1: flatpak: not found
sh: 1: kitinerary-extractor: not found
[Wed Feb 08 11:08:37.015058 2023] [access_compat:error] [pid 1846] [client 192.168.1.56:58131] AH01797: client denied by server configuration: /var/www/nexcloud/data/.ocdata

PASTE HERE


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

That's up there, innit?

So, Not sure exactly what I’ve done wrong here. It worked fine until I started tuning the E-mail New User Template, which did work for a short time.

The “AH01797: client denied by server configuration: /var/www/nexcloud/data/.ocdata” is news to me, and Could be what my issue is, but am unsure if that’s really the cause OR what exactly.

Note: I’m new to Linux and Nextcloud overall, so I’m learning as I go. I like the software and what it can do, but initial setup and fine tuning seems to be … quite fun, if you aren’t sure of what you’re doing.

For the record: It’s just a regular Ubuntu server install on a retired workstation PC. I spent about a week weeding out the configuration warnings and errors (except the Memory cache one, every time I’d try to implement that it would result in an Internal Server Error, that’s for another day)

Thanks ahead for any insight on how to resolve this one. It’s a test deployment for a very small business – we’re talking less than 20 workers. I’m doing this as a paid employee, but with my own surplus equipment.

Before you try to send mails via Nextcloud mail app, you first should setup your mailserver (f.ex. Postfix and Dovecot) to create IMAP mailboxes, send and receive emails.

In the case of dialup connection you will need a DynDNS domain and a properly working mail-gateway.

In the internet you will find good tutorials, how to configure a mailserver.

If working, then you will configure the mail-app of Nextcloud (Admin - Settings - Mail)

I did say things were working prior, right? From where I was sitting at 4am this morning, it was borked enough I decided to seek help from a group that’s got some greater experience than I. Thus the log inclusions.

I was right about one thing:
It wasn’t the mail app failing, it was the NewUserMailHelper that caused my issues. I fixed it by taking the NewUserMailHelper.php from my home installation, editing it in a GOOD text editor (Notepad++ on Windows, to be exact), and testing it at home. Once I established the updated one at home worked, I Secure Shelled my happy tail into the work server and EMPTIED the work NewUserMailHelper.php, saved, and then copied to clipboard the contents of the NEW one and pasted it, and it works. So, whatever I did hand-typing this morning was resolved with what was, in effect, a fresh copy of the php script.

Next thing: BLOCKING SSH FROM OUTSIDE OF WORK, that’s a security issue I didn’t plan for. (In some ways it was a good thing, but Yeah, someone smarter than me would find a way to … Play with things)

Unlikely anyone else will have this issue, but if they do: You probably typed something in such a way the other calls in the script decided to provide you a middle finger and the fastest way to fix it is to use a clean copy of the script. Don’t do what I did, make an emergency copy of the file just in case you bork it like I did.