You have already completed the configuration of Dovecot. So fetching emails via IMAP should already work. Let’s give it a try using a simple-looking but powerful IMAP client: mutt.
mutt -f imaps://john@example.org@webmail.example.org
The connection URL may look a little confusing because of the two “@” characters. Usually mutt expects the format imaps://user@server
. And as we use the email address as the “user” part you get this look.
You should get prompted for the password which we set to “summersun”. If you get any certificate warnings then check if you used the correct server name to connect to and if you completed the certificate/LetsEncrypt part earlier in this guide.
After logging in you will see an empty inbox:

Very good – IMAP connections and authentication works. That’s all we wanted to test. Exit mutt by pressing “q”.
Hello,
In this step I get an error. I attach it:
dovecot: auth-worker(36067): Error: mysql(127.0.0.1): Connect failed to database (mailserver): Access denied for user ‘mailserver’@’localhost’ (using password: YES) – waiting for 125 seconds before retry
I had the same error in a different place (Testing email delivery), but you may have made the same error I did – there are several files where the mailserver user name and password must be entered – in one of them (/etc/dovecot/dovecot-sql.conf.ext), I entered the password for mailadmin instead of mailserver. Check that and all of the files you had to create and incorporate into postfix’s main.cf file.
Again… You can’t send mail as john if John doesn’t exist since he was deleted. Right?
If you have in Postfix smtpd_recipient_restrictions=reject_sender_login_mismatch, you cannot send as another user. If you do not have this directive (and you are logged in), you can have anything in MAIL FROM.