Configuration could not be verified – Is the username or password wrong? from Thunderbird with Postfix and Dovecot on Ubuntu Server 16.04

dovecotpostfixubuntu-16.04

So I have done a very basic install of Postfix and Dovecot on my Ubuntu Server 16.04 and I am having trouble to setup / login to my account with Thunderbird.

Installed of Postfix by following steps 1-5 in this guide:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-16-04
Installed Dovecot with the help from this link: https://help.ubuntu.com/community/Dovecot

The error I got from Thunderbird is "Configuration could not be verified – Is the username or password wrong?". When I look in syslog, auth.log and mail.log I am unable to see why and where the login fails. Mail.err does not include any details either.

If I run "postconf -n" I get the following:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 104857600
mydestination = $myhostname, example.com, mail.example.com, localhost.example.com, localhost
myhostname = localhost.localdomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = hash:/etc/postfix/virtual

If I run "dovecot -n" I get the following:

# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 4.4.0-93-generic x86_64 Ubuntu 16.04.3 LTS
mail_location = maildir:~/Maildir
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
   special_use = \Drafts
  }
  mailbox Junk {
   special_use = \Junk
  }
  mailbox Sent {
special_use = \Sent
  }
  mailbox "Sent Messages" {
special_use = \Sent
  }
  mailbox Trash {
special_use = \Trash
  }
  prefix =
}
passdb {
  driver = pam
}
protocols = imap
service imap-login {
  inet_listener imaps {
   port = 993
ssl = yes
  }
}
ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key
userdb {
  driver = passwd
}

If I run "telnet localhost imap2" and then A1 LOGIN username password I get this result:

anders@toshiban:~$ telnet localhost imap2
Trying ::1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot ready.
A1 LOGIN anders password
A1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SPECIAL-USE] Logged in
e logout
* BYE Logging out
e OK Logout completed.
Connection closed by foreign host.

Please let me know if there is anything I can add to this question in order to help you help me figure this out.

Best regards
Anders

Best Answer

Updated my DNS with the correct settings for imap.example.com and smtp.example.com and got it to work.