So you are a website owner or creator. Congratulations! Undoubtedly, your website needs to be sending emails. In order to do this, it uses an SMTP server. However, you can choose to send from an alternative SMTP server, not just the one configured by your hosting provider, in order to get a few more options.
Which SMTP server to choose, how to connect and configure it, what do the particular settings mean? This is what we are going to talk about today.
Which SMTP Server Should You Choose?
Here are a few options you may choose from:
- The SMTP server of a public free mail service (like Gmail or Yahoo). You must have an email address on this service. This option is suitable only for small volumes (no more than 100 emails per day) or for conducting tests.
- Your company’s corporate SMTP server, such as the one provided by Microsoft 365, Google Workspace (former G Suite), or Zoho. SMTP servers are also usually offered by your site’s hosting provider. For example, BlueHost offers Microsoft 365. This option is good for moderate volumes (several thousand emails/day).
- Commercial SMTP service (like SendGrid or UniOne). This option is suitable for any volume, up to 10M emails/day and higher.
Choosing an SMTP server is a huge topic for a separate discussion. For now let’s suppose you have already decided on which one to use. Now you need to connect an SMTP server to your website. Where do you start from?
Basic SMTP Settings
To start sending emails, your script needs to access the SMTP server. An SMTP server is just a computer with specialized software connected to the Internet. The server is responsible for further forwarding the email to the addressee.
To access this computer, we must specify the following settings:
- SMTP server address (aka SMTP host). Usually, this is a name, not an IP address. For example, this could be smtp.gmail.com for Gmail, smtp.office365.com for Microsoft 365, or smtp.us1.unione.io for UniOne. This is required so that your website knows where to send a request.
- Login (aka username). In the case of Gmail or Microsoft 365, it is the same as your email. For specialized SMTP services, it may be necessary to specify your user ID (as in UniOne) or even just a certain string (for example, in SendGrid, it is the “apikey” line). The login is needed to identify you as the user who is asking to send an email.
- Password. For public email services such as Gmail, this is the password for your email account. In some corporate email services, you need to create a separate unique password for SMTP. For example, a special application password is created in Google Workspace. In specialized SMTP services, an API key is often used as a password (as in both UniOne and SendGrid).
Besides these mandatory settings, it is often required (or at least possible) to specify some additional ones described below.
Additional SMTP Settings
When we mention additional SMTP settings, we are talking about the encryption protocol choice. Back when email was invented, no one ever foresaw the need to encrypt it. When encryption became a necessity, several protocols were developed. To follow the correct protocol supported by your SMTP provider, you must specify the following settings:
- Type of encryption protocol: TLS, SSL, or no encryption. It is recommended to always enable encryption. Otherwise, there is a risk of your messages, username, and password being intercepted. TLS is the most modern and secure option. However, there are several versions of TLS, and your website may fail to connect using the version required by your SMTP provider. In this case, you will have to choose SSL.
- Port is a number that usually depends on the chosen encryption protocol. Its typical values are 587 or 25 for TLS, 465 for SSL, and 25 for unencrypted mail. But the system administrator of your SMTP provider can choose to set up any other port (for example, 2525). Therefore, if the standard ports do not work, you need to check the value with your SMTP provider.
Now that you know what SMTP server options are for, you can choose the appropriate values for your project and configure it to connect successfully. Happy mailing!