Nextcloud gmail email account config

I’ve done a test, hope it helps.

  1. Login to your Gmail account

  2. Go to Settings -> Forwarding and POP/IMAP: Enable IMAP, and Save settings

    • gmail-forwarding-enable-imap
  3. If you use 2-Step-Verification, generate and app password:
    3.1. Select the app and device you want to generate the app password for:

    • Select app: Other (Custom name): Nextcloud Mail app
    • click Generate button
      Sample App Password:
      gmail-generated-app-password
      gmail-app-password-created
  4. On Nextcloud, open Mail app and add mail account providing your credentials: Name, Mail Address, (app) Password.
    If autoconfiguration fails, try with Manual configuration (see Use IMAP to check Gmail on other email clients). Example:

    • Name: Your name
    • Mail Address: example@gmail.com
    • IMAP Host: imap.gmail.com
    • IMAP Port: 993, IMAP Security: SSL/TLS
    • IMAP User: example@gmail.com
    • IMAP Password: (app) password
    • SMTP Host: smtp.gmail.com
    • SMTP Port: 465, SMTP Security: SSL/TLS
    • SMTP User: example@gmail.com
    • SMTP Password: (app) password

Notes: I’ve tested with an account using 2-Step-Verification and generated the 16- character App Password, without spaces. No further troubleshooting steps were required.

Troubleshooting:

  • Temporarily enable debug and increase loglevel (nextcloud’s config.php file) and monitor nextcloud.log file:
  'debug' => true,
  'loglevel' => 0,

furhter logging can be obtained (horde_imap.log, horde_smtp.log) adding:

'app.mail.imaplog.enabled' => true,
'app.mail.smtplog.enabled' => true,
  • SMTP Security: I’ve read STARTTLS can fail with nextcloud app
  • If log reports timeout errors you can add some app settings to nextcloud’s config.php file:
  'app.mail.imap.timeout' => 30,
  'app.mail.smtp.timeout' => 30,
5 Likes