Send emails with Nextcloud
Point Nextcloud's email server at PostShiba.
What you'll build
A self-hosted Nextcloud server that sends its password resets, share notifications, and activity emails through PostShiba over SMTP.
Before you start
- A Transactional cluster. Server notification mail belongs on a transactional cluster, and the type is locked after create. See Clusters.
- An SMTP username and password. Open your cluster in the dashboard, go to its SMTP credentials, and choose Create SMTP credential. Copy the password right away, because it is shown once. You can also use the SMTP credentials API.
- A verified sending domain. See Add and verify a domain. The From address must be on it.
- A cluster that is ready to send (
sending_readyistrue). - A Nextcloud admin account with an email address saved in its personal settings. The test email goes there.
Install
Nothing to install. Nextcloud has SMTP support built in.
Send your first email
- Sign in as an admin. Open the avatar menu, then Administration settings → Basic settings, and find Email server.
- Set Send mode to SMTP and Encryption to None / STARTTLS. Nextcloud upgrades the connection with STARTTLS on port 587. Do not pick SSL/TLS, because it is for port 465. Leave Disable certificate verification (insecure) unchecked.
- Under From address, put the part before the
@in Email and your verified domain in Domain. - Under Server address, set Host to
smtp.postshiba.comand Port to587. - Under Authentication, check Authentication required. Set Login to your username, which starts with
smtp_, and Password to your password. - Select Save settings, then Send test email. Before Nextcloud 33, the button is Send email. The message shows under Events in the PostShiba dashboard.
The form writes these keys to config/config.php. You can set them there instead. mail_from_address is only the part before the @, and mail_domain is the part after it. An empty mail_smtpsecure means STARTTLS when the server offers it.
You can also set each key with occ config:system:set, for example occ config:system:set mail_smtpport --value=587 --type=integer.
There is no setting for the authentication method. Nextcloud picks one that the server offers. Every SMTP setting is on Send emails with SMTP.
Troubleshooting
Nextcloud's Activity app sends activity emails and digests from background jobs, so a server with many users can send a lot of mail in a short time. Size the cluster so its hourly and 24-hour caps cover it. When a cap is full, SMTP answers 451 4.7.0 hourly send limit reached or 451 4.7.0 daily send limit reached and does not keep the message. See What happens at your cap.
To see the full SMTP reply, set 'mail_smtpdebug' => true and 'loglevel' => 0 in config/config.php, send the test again, and read the Nextcloud log. Set them back to false and 2 when you are done.
| What you see in the Nextcloud log | What to do |
|---|---|
| Authentication fails | Check Login and Password, and check that Authentication required is on. PostShiba accepts AUTH PLAIN only. |
| The connection fails or times out | Check that Port is 587 and Encryption is None / STARTTLS. Port 465 with SSL/TLS is not offered. |
550 unverified domain or 550 from header not aligned with verified domain |
Set Domain under From address to your verified domain. Without it, Nextcloud uses the server's own hostname. |
550 domain_suspended |
The From domain is paused. Resume it from Managing domains. |
550 kyc_required |
Your team is pending production approval. Until then, send only to team members, live inbox addresses, and inbox forward-to addresses. See Does PostShiba require production approval?. |
550 suppressed or 550 firewall: <rule> |
The recipient is on the suppression list or failed an email firewall check. PostShiba suppresses addresses that hard bounce or report spam. |
451 4.7.0 hourly send limit reached or 451 4.7.0 daily send limit reached |
The cluster is at its cap and did not keep the message. Retry later, or resize the cluster. |
Next steps
- What happens at your cap
- How to manage suppressions
- Send emails with SMTP for every setting and reply.
- Managing webhooks to receive delivery events.