Email Server Post Image

For many people, the word “server” only brings to mind a tool for web hosting. As we’ve discussed before, however, there are many great uses for servers. Today, we’re going to be talking about managing a server dedicated to email using your own domain. What we’re talking about in this post is slightly more advanced, but it’s something that any moderately able system administrator should have no trouble tackling.

Should You Consider Running Your Own Mail Server?

First thing’s first, a user has to decide whether it makes sense to run his/her own mail server. Such a server does offer total control over the email on the associated domain, but it can also bring about some headaches. Of course, the benefits of doing this will greatly outweigh any potential negatives for many users, so let’s evaluate both sides of this:

Benefits of Running Your Own Mail Server

  • Full control over the server
  • Full control over your email
  • Log access to all messages, both incoming and outgoing
  • Choice of applications and custom configuration
  • Ability to access raw mail files

Difficulties of Running Your Own Mail Server

  • Server maintenance can be difficult
  • Email configuration can also be difficult
  • Little room for error with SPAM & virus filters
  • Risk of associating SPAM to user IP, possibly getting IP blacklisted
  • Any downtime may cause user to lose messages

Once you’ve carefully weighed the benefits against any potential drawbacks, you should have a pretty good idea about whether running your own email server is the right option for you. If managing the server seems to be more than you’re prepared to handle, you can always check out third-party mail services that can handle a lot of the grunt work for you.

Getting Started

If you are looking to manage your own email server, you must first begin by understanding how these servers work. There are three separate components:

  1. Mail Transfer Agent (MTA) – The MTA is what relays mail between your server and the rest of the internet.
  2. Mail Delivery Agent (MDA) – The MDA parses out messages from the MTA queue and saves them to the appropriate mailboxes on the server.
  3. IMAP/POP3 Connections – The IMAP/POP3 connection is used to manage users and mailboxes. IMAP connections are recommended for users who will check their mail on multiple devices, as the mail will be saved on the server and available on each device. POP3 connections save the mail directly to a local mail client.

Now that we’ve introduced the components of an email server, let’s discuss how they actually work together. Incoming messages are directed to specific locations by DNS. Once messages pass through the MTA and MDA, they are then saved to either the server or the user’s local mail client, depending on whether he or she uses IMAP or POP3 connections. Outgoing mail is sent from the user’s local mail client to the internet by way of the MTA. Additional optional components, such as spam filters, webmail clients and virus scanners, may also be added.

Building Your Mail Server Step-by-Step

Once you’ve selected your initial components, you can begin building your server.

Step 1: Install an SSL Certificate. This certificate encrypts your connection to the mail server. It protects passwords and keeps your email from being spied on. While you can run a mail server with this encryption, we certainly don’t recommend it!

Step 2: Configure server components. Once you’ve chosen which MTA, MDA and IMAP/POP3 connection you plan to use, install and configure them to your specifications. Each of these may be slightly different, but no matter what you plan to use, you should receive an installation guide with your purchase.

Step 3: Create your DNS records. These are what distinguish your server as a legitimate mail server.

Step 4: Create your MX records. MX records are what dictate that mail is sent to your email. Outgoing servers look up DNS settings to identify the domain in an email address. MX records serve as an identifier for your server. Unique MX records must be created for each domain and subdomain for which you plan to receive mail on your server. Pro tip: It is possible to create multiple MX records that are assigned different levels of priority for each domain. This is a way to create fallback mail servers for your domain.

Step 5: Create SPF records. SPF records tell other receiving mail servers which outgoing servers are legitimate mailers and provide information about domains, TTL (time to live), type of email and text. This is an important step in keeping your domain from becoming a target for spammers to use maliciously.

Step 6: Set reverse DNS for your mail server’s domain (or subdomain, if applicable). Your reverse DNS and hostname must match or else the network will reject any email sent from your server.

Once you’ve made it through these steps, you will have a functioning mail server. At this point you can begin customizing. Additional features, such as SPAM filters and virus scanners, may be added in this stage.