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

  1. You open Gmail client, write an email, and press send!
  2. Gmail in the background uses secure ports like 465 or 587 to identify who you are (Authentication and Authorization) to send that email!
  3. 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.
  4. Gmail connects to that IP on port 25 and sends your email.
  5. box.simolog.com (my Mail-in-a-Box) receives SMTP connection.
  6. Mail-in-a-Box will verify the recipient - do we have a mailbox called “me@simolog.com” that exists on the server!
  7. Accept the email if the mailbox exists and store it!
  8. Mail-in-a-Box sends “250 OK” back to Gmail server!
  9. Gmail server marks email as delivered.

Second Case: Mail-in-a-Box to Gmail

Mail-in-a-Box to Gmail flow

  1. I go to https://box.simolog.com/mail login, compose and send you an email.
  2. Mail-in-a-Box checks Gmail’s MX record, finds the IP, and sends to port 25.
  3. Gmail receives SMTP connection from box.simolog.com.
  4. Gmail verifies SPF record - checks DNS: “Is box.simolog.com IP allowed to send for simolog.com?”
  5. DKIM: Does the signature match the DNS key?
  6. DMARC: If it fails, what should we do with the email (reject, spam, or ignore)?
  7. Gmail verifies the recipient mailbox exists on Gmail’s servers.
  8. Gmail accepts the email and stores it in my inbox.
  9. 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!