Nextcloud SMTP settings for the email server

Nextcloud sends password resets, share notifications and activity emails through the **Email server** form under **Administration settings → Basic settings**, which writes `mail_*` keys to `config/config.php`. The From address is split in two: `mail_from_address` holds only the part before the @, and `mail_domain` holds the domain.

Need an API key?

SMTP password is a Unitpost API key with emails:send. Username is always unitpost.

  • 5,000 emails/month
  • 3 API keys
  • 5 sending domains
Get free SMTP key
  1. Create a send-only key

    In Unitpost, open Settings → SMTP and create a send-only key. The domain in mail_domain must be verified.

  2. Fill in the Email server form

    Pick None/STARTTLS for port 587: Nextcloud upgrades with STARTTLS whenever the server offers it, and Unitpost always does on 587. Pick SSL (SSL/TLS in newer releases) for port 465.

    Send modeSMTP
    EncryptionNone/STARTTLS
    From addressnextcloud @ yourdomain.com
    Server addresssmtp.unitpost.com : 587
    AuthenticationRequired
    Loginunitpost
    PasswordYour Unitpost API key
  3. Or set it in config.php

    The same settings as config/config.php keys. mail_smtpsecure is '' for STARTTLS on 587 or 'ssl' for 465.

    PHP
    'mail_smtpmode' => 'smtp',
    'mail_smtphost' => 'smtp.unitpost.com',
    'mail_smtpport' => 587,
    'mail_smtpsecure' => '',
    'mail_smtpauth' => true,
    'mail_smtpname' => 'unitpost',
    'mail_smtppassword' => 'pk_live_...',
    'mail_from_address' => 'nextcloud',
    'mail_domain' => 'yourdomain.com',
  4. Send a test email

    Add an email address to your own account under Personal info first: the test button under the form (Send email, or Send test email in newer releases) sends to it. The message then shows in Unitpost Emails.

  5. If the test fails

    535 5.7.8 means the login isn't unitpost. 550 5.7.1 means mail_domain isn't verified. A hang on port 465 means encryption is still set to None/STARTTLS.

Search docs and guides

Search the docs and product guides.