Best practice for Kentico newsletter setup

Kentico's Email Marketing is a powerful way to stay in touch with your customers and site visitors, especially when you leverage the information that EMS functionality can provide you. If you're utilizing these features, there's a good chance that you’ll be looking at sending high volumes of email. In this article, we'll look at best practices for configuring Kentico to send these emails as quickly as possible. 

Ultimately, your exact configuration and approach will be based on your project's specific needs, but in general, our recommendations for high volume email can be summarized as follows:

  • Use the email queue. This allows you to use multiple SMTP servers and provides insight into the sending status of your emails.
  • Use multiple SMTP servers. Even if you are using a high volume email service, if you have multiple SMTP servers, you can increase your throughput from the Kentico side while adding redundancy in the event of server failure. This is only available to sites with an EMS license.
  • Use the external scheduling service. This enables the email tasks to be processed on a regular schedule independent of page requests.
  • Avoid attachments. This increases the time it takes to send messages and can result in the message being rejected.
  • Avoid archiving sent emails. This will unnecessarily grow your database, so unless you need to for regulatory or debugging purposes, avoid it.

Let’s break down these recommendations further to help you understand some of the reasoning behind the recommendations.

Use the Email Queue

Screenshot of Email Queue

You can enable the email queue in Settings -> System -> Emails in the Email Processing section. Enabling this setting is a good idea, regardless of the email volume you’re dealing with. When enabled, all emails are stored in an email queue in the Kentico database prior to being sent. You can view the status of emails in the queue by opening the Email Queue application. Kentico processes the queue in batches in order to prevent emails from being lost in the event the thread aborts due to an error, application restart, etc. Using the queue also allows the system to leverage our next recommendation: using multiple SMTP servers.

Use Multiple SMTP Servers

Screenshot of SMTP Server Application

If your site has an EMS license, you can configure the system to have a pool of SMTP servers to select from when sending emails. As noted previously, you need to enable the email queue feature in order to actually use multiple SMTP servers. There are two main ways you can configure SMTP servers in the SMTP Servers application: network and pickup directory delivery. There are actually two different pickup directory options, but they are just configuration variations. In my limited testing, sending emails with the pickup directory delivery methods resulted in Kentico being able to send 100s of emails a second. The pickup directory option reduces the load on Kentico, but does require more custom configuration of the server. You also have to consider disk IO speed and available disk space when using this delivery method. The other delivery method, network, is much more common. In my limited testing, my SMTP servers were only capable of sending between 15-25 emails a second. While this is slower than the pickup directory method, there are SMTP services that are much faster and you can further speed things up by adding additional SMTP servers to pool. Assuming your email servers are all capable of sending emails at the same rate, you will see linear increases in email throughput by adding servers to the pool. Additionally, adding additional SMTP servers to the pool increases redundancy, as you have additional servers to process emails in the event one or more email servers becomes temporarily or permanently unavailable. The SMTP server is typically the bottleneck when trying to send lots of emails, and configuring multiple SMTP servers is one of the best ways to improve delivery time.

Use the External Service

Screenshot of Service Manager

After installing and configuring the Kentico Scheduler Windows service, you can enable the external service in Settings -> System in the Scheduler section. Like the email queue, setting up the external scheduler is a good practice for all production sites. This allows the scheduled email tasks for processing the email marketing emails and sending emails from the email queue more consistently as they are executed on a timed basis rather than on a timed basis that has to wait for a request in order to be processed.

Avoid Attachments

Regardless of the delivery method, one thing to avoid is attachments. Particularly, you'll want to avoid large ones. It is better to reference images on your public website rather than attach them to the email as this will increase the time it will take to send and you run the risk of the email being rejected due to it being too large. 

Avoid Archiving Sent Emails

When configured, the Archive Emails (days) setting will store a copy of emails that have been successfully sent in the database for as many days as specified. You can find the setting in Settings -> System -> Emails in the Email Processing section. If you are sending large volumes of email, even one day's emails can seriously grow your database size and affect database performance. This feature should only be enabled if you need an audit trail, or are trying to debug your email sending.

Posted: Monday 14 March 2016