What contributes to a large CMS_Email table in the database?

If you have enabled the Email queue, and changed the Archive e-mails (days) settings in Site Manager --> Settings --> System --> E-mails, you will probably have some records in the CMS_Email table in your database. This article explains what records the table contains.
The CMS_Email table contains records for any email which is currently in the Email queue (Site Manager --> Administration --> E-mail queue) as well as any emails which have been sent and remain in the Email queue (Sent e-mails tab).  If you take a look at the EmailStatus column in the CMS_Email table you might see a few different statuses.  The list below represents the EmailStatus ID’s in the database.

E-mail is being created = 0
New or failed e-mail waiting for sending = 1
E-mail is being sent = 2
Archived e-mail = 3

An EmailStatus of "1", means the email is a new or failed e-mail waiting for sending, while and EmailStatus of "3" means the email has been sent and is archived.  You can set the number of days the emails stay in the email queue (Archived status), or you can disable the email queue all together from Site manager --> Settings --> System --> E-mails --> Enable e-mail queue/Archive e-mails (days).

Records can still be contained in this table even if you are not using the email queue.   If there is a value set in the Site manager --> Settings --> System --> Error notification e-mail address field, and for some reason these emails are not received, the system will logs these to this table.  In order to stop adding records to this table, you would need to disable the Email queue, set the Archive e-mails (days) to zero, and remove the value set in Site manager --> Settings --> System --> Error notification e-mail address.

Applies to: Kentico CMS 7.x
Share this article on   LinkedIn