Using external SMTP server with Kentico 12
In this short article, you’ll learn how to configure three popular SMTP servers that you can use to send emails from your Kentico projects.
The most commonly used SMTP servers among Kentico customers are Office 365 SMTP, Sendgrid SMTP Service, and Amazon SES SMTP. In the Kentico administration, the configuration of the default SMTP server happens in the Settings application → System tab → Emails → Default SMTP server section.
Office 365
In order to use Office 365, you will need an Exchange Online account. The service comes with some limitations, so you won’t be able to send out large email blasts to tens of thousands or more recipients on time.
However, if your email sending requirements are within these limitations, Office 365 will be a good and reliable choice. To configure Kentico to work with an Office 365 SMTP server, you will need to note a few values from this guide.
Keep in mind that the “From“ (or "Sender email address") address must match the user name of your account, no matter what kind of emails you’re sending.
- SMTP server: smtp.office365.com (in case of Office 365 business accounts, you have to include port number: smtp.office365.com:587)
- SMTP server user: the user name of your Office 365 account used for authentication
- SMTP server password: your password
- Use SSL: must be enabled because the secure connection is required
If you have turned on Kentico's bounced email monitoring feature, the “Bounced email address” property overwrites the “From” field of marketing emails. Make sure the property is the same as your O365 user name.
Sendgrid
If you're looking for a standalone cloud-based SMTP server with the capability to distribute a huge amount of emails, Sendgrid can get the job done. The service offers several pricing plans you can pick from depending on your requirements. They also offer a “Free” plan, but it's fairly limited.
Find the credentials and other settings in this guide.
Sendgrid’s sending policy is not as strict as Exchange’s and allows you to specify any sender name in the From field.
- SMTP server: smtp.sendgrid.net
- SMTP server user: the user name of your Sendgrid account
- SMTP server password: your password
- Use SSL: must be enabled because Sendgrid requires a secure connection
Your hands are not tied, even when it comes to choosing a port number, because Sendgrid accepts:
- unencrypted (no port number) connection,
- TLS connection on ports 25, 587 and 2525, and also
- SSL on port 465.
Just add the port number at the end of the SMTP server field in Kentico.
Given Sendgrid’s openness to customizations, your “Bounced email address” property does not have to reflect your Sendgrid account email address.
Amazon SES SMTP
If you’re using the Amazon SES platform, you can also use the Amazon SES SMTP interface for outgoing emails. The service gives you an option to choose from multiple endpoints located on four different continents, which means your emails don’t have to travel across the world.
Before getting into the Kentico administration, you need to obtain credentials to the SMTP server. Log in to Amazon and follow Amazon's documentation. Don’t forget to copy & paste your credentials to a text file, since Amazon shows you the credentials just once. If you lose your credentials, you'll need to generate new ones.
- SMTP server: one of the available endpoints, e.g., email-smtp.us-east-1.amazonaws.com
- SMTP server user: obtained username
- SMTP server password: obtained password
- Use SSL: must be enabled
All Amazon endpoints require encrypted connections using TLS protocol, and the available ports are 25, 465, and 587.
Choose One that Fits You
This article outlined ways to connect Kentico to external cloud-based SMTP servers. Even though the mentioned cloud-based solutions are popular, there are many other SMTP offerings on the market and every service has its own pros and cons. Consider your requirements in advance and pick the service that best suits your needs.
Are you curious how quickly you can send marketing emails with these SMTP servers and what their performance is? Then check out the next article!
P.S. When speaking about emails, you may also like this article which shows more tips & tricks regarding Email marketing: Best practices for configuring email marketing.