Email Server Project

Objective:

Manage and configure an email server using a personal domain on a residential internet connection.


Primary Goal:

Set up a reliable email server to send and receive emails for services running on my domain, reducing dependency on Gmail and other free email services.


Initial Setup

Platform:

  • Zentyal: Linux-based all-in-one replacement for Microsoft AD environment with Exchange using Samba.

  • AD Domain Management: Managed via RSAT on domain-joined laptop and desktop.

  • Outlook Integration: Connected as if using an Exchange server, though running on Linux.

Challenge Encountered

Issue:

  • Port 25 Blocked: ISP blocked port 25, halting email sending and receiving.

Solution:

  • SMTP Smarthost: Discovered SMTP smarthosts for free email relaying under a few thousand emails per month.

  • Alternative Port Usage: Enabled sending and receiving on a different port to bypass ISP restrictions and add some level of obscurity.

SMTP Smarthost Configuration

Service Used:

  • SMTP2GO: Set up for email relaying.

DNS Configuration:

  • SPF & DKIM Records: Configured for domain to avoid spam classification.

  • Testing: Verified configuration with mxtoolbox and sent test emails to various services; no emails were marked as spam.

Exploration of Email Servers

Email Servers Tried:

  • Postfix & Dovecot: Set up for testing.

  • Webmail Frontends: Tested SquirrelMail, RoundCube, and SOGo.

Final Choice:

  • iRedMail: Chosen as the preferred server due to simplicity and a nice management interface.

Current Solution:

  • a2hosting Managed Email: Shifted to a managed service to focus on other home-lab projects.

Key Learnings

  • DNS COnfiguration: Gained experience in configuring SPF & DKIM records.

  • Spam Prevention: Learned to use fail2ban, greylisting, and other methods to combat email spam.

  • SMTP Smarthost: Gained expertise in using SMTP smarthosts for sending emails from websites and services.

  • Time Management: Realized the importance of prioritizing time on exciting tech projects over managing email spam.



This project involved managing and configuring an email server to send and receive email using my personal domain on a residential internet connection. The primary goal was to have a working email server with my own domain name, so I could reliably send and receive email for services running on my domain and stop using Gmail and other free email services.

My network was still small and most of my services were being served by Zentyal, running on a single physical server. Zentyal is a Linux-based all-in-one replacement for a Microsoft AD environment with Exchange using Samba and other services. At this point in time, I was more focused on learning Windows, while using their tools and software. It was very cool to be able to manage my own AD domain using RSAT on my domain-joined laptop and desktop, as well as being able to use Outlook like it was connected to an Exchange server, even though it was all running on Linux.

After this was all setup and running, my email setup suddenly had to change after I stopped being able to send and receiving email. Port 25 had been blocked by my ISP. After some searching on how to continue using my email from this server, I found SMTP smarthosts. They provided free relaying if your server was sending under a few thousand emails a month. I might only send and receive 100 emails in a month, so it was exactly what I needed. These relays would also allow me to send and receive email on a different port as well, so I could bypass the restrictions and provide some security by obscurity, which we know is not proper security, by not using port 25.

I setup an account with SMTP2GO, along with the proper SPF and DKIM records for my domain, so that I could send and receive from the smarthost and not have my emails marked as spam. I tested with mxtoolbox and everything passed without alerting to any potential issues. I sent and received several emails to different email services to see who, if any, would mark my emails as spam. Through all of the testing, I was able to receive all of my emails without being marked as spam.

As I worked on my home-lab, I tried a few different email servers. I have setup Postfix and Dovecot servers. I also tested SquirrelMail, RoundCube, and SOGo as the webmail frontends for those servers. I landed on iRedMail as the server of choice. Even though I had a server setup that is as simple as installing from an apt repository with a nice management interface, I decided that email isn’t that much of a priority in my setup. I am currently using the a2hosting managed email service, which has allowed me to spend far more time working on the servers that I want to spend time on.

Through this project, I learned how to configure DNS for my domains, along with the SPF and DKIM records for email. I learned about using fail2ban, greylisting, and other methods to fight email spam. I learned how to use an SMTP smarthost, which I am still using for sending emails from my websites and other services that have automated reports. The most important thing that I learned is that I would rather spend my time finding and implementing new and exciting tech for my home-lab and not fighting spam!