In the past few days, I was thinking about creating my own professional email. I said, “Why not have me@simolog.com? It looks nice, no?” I also wanted to use a free service, but I didn’t find any free options, so I decided to use Mail-in-a-Box and an Oracle Cloud VPS (free forever: 1 GB RAM, 50 GB storage). It would be enough for me! The idea was very promising!
“Self-host a mail server on Oracle Cloud (forever plan)”
But it was too good to be true. I set up Mail-in-a-Box on Oracle Cloud, but later I found that Oracle blocks port 25. I didn’t understand much about why, but what I learned is that port 25 is more important than I thought! Basically, mail servers talk to each other using the SMTP protocol and port 25!
I later changed the VPS provider to kamatera (free for 30 days), so I could set up and see how things work. I reached my first goal of having me@simolog.com, but I can’t host it for free!
How Mail Servers Work
Let’s say you want to reach me at me@simolog.com and I answer you back. So how do things work in mail servers when we press Send?
First Case: Gmail to Mail-in-a-Box
- You open Gmail client, write an email, and press send!
- Gmail in the background uses secure ports like 465 or 587 to identify who you are (Authentication and Authorization) to send that email!
- When everything is good, Gmail server queries DNS (Domain Name System) for simolog.com MX record to find Mail-in-a-Box’s server IP.
- Gmail connects to that IP on port 25 and sends your email.
- box.simolog.com (my Mail-in-a-Box) receives SMTP connection.
- Mail-in-a-Box will verify the recipient - do we have a mailbox called “me@simolog.com” that exists on the server!
- Accept the email if the mailbox exists and store it!
- Mail-in-a-Box sends “250 OK” back to Gmail server!
- Gmail server marks email as delivered.
Second Case: Mail-in-a-Box to Gmail
- I go to https://box.simolog.com/mail login, compose and send you an email.
- Mail-in-a-Box checks Gmail’s MX record, finds the IP, and sends to port 25.
- Gmail receives SMTP connection from box.simolog.com.
- Gmail verifies SPF record - checks DNS: “Is box.simolog.com IP allowed to send for simolog.com?”
- DKIM: Does the signature match the DNS key?
- DMARC: If it fails, what should we do with the email (reject, spam, or ignore)?
- Gmail verifies the recipient mailbox exists on Gmail’s servers.
- Gmail accepts the email and stores it in my inbox.
- Gmail sends “250 OK” back to Mail-in-a-Box.
This is how we talk, my friend!
SPF, DKIM, DMARC, and MX are generated by Mail-in-a-Box during installation, and it asks you to put them in your domain name provider!