Dovecot is IMAP and POP3 server, install with:
apt install dovecot-imapd dovecot-pop3d
NOTE: For plain login enable the plain login in /conf.d/10-auth.conf and disable the ssl login
in /conf.d/10-ssl.conf.
#/etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_uid =mail
mail_gid =mail
mail_privileged_group =mail
mail_access_groups =mail
The mail_location mbox is /var/mail/user, and other mail dirs like Drafs, Sent and
Trash will be created in the user home directory inside the mail directory.