Keep Deleted Emails on Dovecot

This section provides a tutorial example on how to keep deleted emails on the mail server by using the 'pop3_delete_type' flag and stoping the 'IMAP' service in Dovecot.

In certain situations, you may want keep deleted emails on the server forever. Here is how you can do it.

1. Turn on the "pop3_delete_type" flag on the POP3 service, with a unique marker like "POP3Deleted".

herong$ sudo vi /etc/dovecot/conf.d/20-pop3.conf

pop3_delete_type = flag
pop3_deleted_flag = POP3Deleted

2. Restart the Dovecot server.

herong$ sudo systemctl restart dovecot

3. Connect to the POP3 service with an email client and delete a test email. POP3 service will hide this email from now on.

4. Connect to the IMAP service with an email client to the same mailebox. You will see that the deleted email is kept and marked as "POP3Deleted".

5. Close the IMAP service and run the POP3 servic3 only. This prevents users using IMAP service to delete emails.

herong$ sudo vi /etc/dovecot/dovecot.conf
  protocols = pop3

herong$ sudo systemctl restart dovecot

Now your mail server will keep all deleted emails hidden. If you want to see them, you can turn on the IMAP service temporarily.

Table of Contents

 About This Book

 Introduction to Email

 Postfix - Mail Transport Agent (MTA)

 SSL/TLS Secure Connections with Postfix Server

Dovecot - IMAP and POP3 Server

 What Is Dovecot

 Install and Configure Dovecot on CentOS

 Test Dovecot IMAP Server with "telnet" Client

 Test Dovecot POP3 Server with "telnet" Client

Keep Deleted Emails on Dovecot

 Turn on Dovecot Server Logging for Troubleshooting

 "doveadm" Command - Dovecot's Administration Utility

 SSL/TLS Secure Connections with Dovecot Server

 Email Client Tools - Mail User Agents (MUA)

 Mozilla Thunderbird - Mail User Agents (MUA)

 References

 Full Version in PDF/EPUB