Setting mail is covered in the documentation: E-mail configuration
How does the test fail? Is postfix even installed, running? Is it necessary have it running yourself or can you maybe use other credentials?
Sorry, I wasn’t clear enough, I meant the e-mail settings in Nextcloud.
If you are an expert or not, as long as you are willing to learn, you’ll get to the point where you want to be.
I would advice not to try and configure postfix for now. Running postfix is not needed for Nextcloud. If you configure postfix in a not-correct way, you’ll end up being used by spammers and getting banned by your provider. For now, using a gmail account is suffice (even though you might want to switch to a more privacy-prone e-mailprovider ).
The “Permission denied” is indicating that the script isn’t allowed to do something. You’ll need to dig in the logfile of php-fpm (persumably in /var/log/) and see if you find something related. A look in the log of nginx might be worth trying also.