I don’t like giving my email out to random websites. Once you give your email, there is really no taking it back. So, for a while now, I have been self hosting a Postfix server out of my college dorm room so I can have “fake” email addresses that forward to my personal one. It has been working great, but now that it has come time to move out, I need to find a new solution.
Introducing: My homemade, self hosted, personal mail server.
The server was build on Node JS. It takes incoming Secure Mail Transfer Protocol (SMTP) requests and handles them. It parses the content, validates receiving email addresses, and saves them to a database. Alongside this, there is also an REST API that allows all messages to be read over HTTP from the server. An authentication system is also in place to prevent unauthorized access to the API.
The Web Interface
The web interface was built using Vue and Tailwind CSS. It allows me to view all emails that have been sent to my server. It integrates with the server’s API to get the emails and display them in a nice way.
The inbox displays all emails that have been received in a list format. It features pagination, and by clicking on an email, you can view the contents.
The message preview displays the contents of a given email. It shows the sender, subject, to, CCs, BCCs, and body of the email.
The biggest challenge was getting the server to work. SMTP is a very complicated protocol, and it took a lot of research to get it working. The way every sending server chooses to send the data can be very different, so I had to make sure that my server could handle all of the different ways that the data could be sent.
Overall, the server is a great success. It is of course running right now, so if you shoot me an email (andrew at aglemons dot com), it’ll go straight to the server. I have considered generalizing my code and making the whole project open source, so be on the lookout for that.