Testing SMTP settings via CLI


Server configuration

Operating system: Ubuntu 22.04

ownCloud version: 10.13

Updated from an older ownCloud or fresh install: fresh install

Where did you install ownCloud from: Docker, owncloud/server:10.13

This is more of a general question and less of an issue with my specific installation, so I’ve opted not to crowd this post with unnecessary installation details. If more information is required, I’m happy to provide.

I am deploying ownCloud using Ansible and a Docker Compose file based on the official template in the ownCloud docs. The last piece of the puzzle that I am trying to figure out is how to send a test email upon completion of the install, but I have (so far) not found any way to do that through the CLI. I know that my SMTP server settings are correct as I can manually send a test email from the General Settings page in the Web UI, but I would much prefer to be able to test these settings via the CLI instead so I can automate this step.

I have attempted to run the command to generate and mail a configuration report as described in the OCC documentation from within the Docker container, but it seems that ‘mail’ is not installed in the container (reports as ‘bash: mail: command not found’). I cannot find any option in the OCC tool to test the SMTP settings either.

All I need is just some kind of command to run to send an email - any email, whether that’s a simple “hello, this works” or the configuration report as described in the OCC documentation mentioned above - via the same mechanism that ownCloud itself uses to send email (thereby proving that the SMTP settings in the config file are valid). I’m open to options here, even if it means running a custom PHP script of some kind. I’ve looked at the ownCloud source code on GitHub and searched up and down Google and all I can find is “test from the UI button”, but I’m not a PHP developer either so I’m having trouble making sense of what exactly that “send test email” button press is doing behind the scenes, which makes the automation of this function a bit tricky.

Any help is greatly appreciated. Thanks in advance.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.