configuring email on a self-hosted domain

 Working environment:

Physical Server:
Synology Diskstation

MailServer:
Synology MailServer (PostFix)

  1. Reverse DNS implemented
  2. Account created as a NAS user
    1. Temporarily assigned read/write permissions to the account
    2. User home enabled
  3. MailServer installed
    1. imap enabled (actually, all protocols enabled, just in case)
    2. Domain enabled
    3. Port assigned
    4. Security enabled
    5. SpamAssassin enabled
  4. MX record created in DNS server (not an intuitive process!)
  5. Email account configured on my phone
    1. username
    2. password
    3. imap server (as per phone mail client default)
    4. message: Unable to connect to email server to verify this account. No response from server
  6. Create outgoing email
  7. Send outgoing email
  8. Sending outgoing email failed

It seems to me that either there’s a visibility problem (not an authentication issue), and the email app on my phone can’t see the mail server.

Or the MX record isn’t doing its stuff, but that could be the problem (if the MX record isn’t routing effectively). Do MX records need time to propagate?

[later]

I revisited the server settings in the phone’s email client, and noticed the phone had put smtp.ahorseforonebin.co.uk and imap.ahorseforonebin.co.uk in, as default.

Although I have enabled those protocols in the MailServer, are they enabled to those addresses?

I edited out the smtp and imap prefixes. When I accept  the settings I still get the same “unable to connect to email server (etc)” error message *but* the error messages are not instantly received, any more. There is some kind of authentication process taking place that is eventually returning an error.

I shall leave the smtp and imap prefixes off the address ranges for now, and carry on with looking for another error.

Memo to self: Go back and reinstate the smtp and imap prefixes, when mail transfer has been effected

[later]

I set aside my phone and created the email account in Outlook Express – being more familiar with that email client, than the one on my phone.

I (re) created the email account in OE and tried to send a test outgoing email. It failed.

Then I did what I should have done an hour ago, I ran a port validation against my static IP.

The port validation reported that port 25 – the default email port – was closed.

I flipped over in to the router and opened port 25 on the internal firewall and tried to send the test message from OE again.

Success! (ever felt like a donkey? Because that’s how I felt – fancy forgetting a basic thing like checking the port was open on the router firewall! I knew the port was open in the NAS firewall, but not checking the router is a schoolboy error)

So I can now send email from the test account in OE. Can I send email from the same test account on my phone?

Yes!

Right then, I need another cup of tea and then I’ll try to find out why the test account doesn’t receive email.

[later]

Learning from earlier, I have just checked the inbound email port settings in OE and found that port 110 is specified. Assuming that port 110 is standard (because why would OE be different to everyone else?) I checked the router firewall and yes, port 110 was closed.

Opened port 110 on the router, checked that port 110 is open on the NAS (it wasn’t, but it is now).

I activated ‘Send & Receive’ in OE and it processed without any authentication errors! Yay!

But no new email is received. Boo!

So where is the incoming email going to, if it isn’t being delivered to the mailbox?

Is this an addressing issue with regard to the MX?

The reverse DNS seems to be working fine, because outbound email hits my Gmail account.

But why isn’t inbound email working?

[after a good night’s sleep]

I sat here for a while looking at the components:

  • Physical server
  • DNS Server
  • MailServer
  • Outlook Express client

I flowcharted the interfaces between the components, to make sure I hadn’t missed anything. I hadn’t.

And yet outbound email worked, but inbound email doesn’t.

I realised that there was another component I had ignored so far, the domain registrar details over at 123-reg.co.uk.

Everything in the control panel looked right.

I knew the nameserver, A, and C records worked, because this domain is viewable.

That left the MX record in the registrar control panel.

Pause for thought:
Yes, it really can be complicating having two of everything, one of everything in the domain registrar control panel, and one of everything on your physical server, but that’s the way it is.

Anyway, I decided to bite the bullet, so I deleted the MX record in the registrar control panel, made myself a cup of tea, and then recreated the MX record.

I opened Outlook Express, composed an outgoing email and sent it to my Gmail account.

I went to Gmail, retrieved the email I’d just sent from OE and replied to it.

And blow me down, the reply appeared in Outlook Express almost instantly.

So we have inbound and outbound email in Outlook Express.

Following the same logic I deleted the email account I had configured in my phone last night and manually (rather than using the phone’s config wizard) configured the email account *as a POP3 account* (see point 5c above) and…

it worked straight away!

Awesome.

Now for the big test.

I took my phone offline from the LAN/WiFi, so it would be an external, remotely attached (via the internet) device, and sent a test email to my Gmail account.

That worked.

Then I replied from Gmail to my phone and that worked too.

So I have successfully configured internet email for a self-hosted domain.

I have no interest in mucking about with webmail, so I will not get involved with RoundCube, SquirrelMail or any of the others.

It has been a fun 12 hours. I’ve learned a huge amount, which will help me when I migrate from the NAS to the HP server.

And if this helps anyone else, that’s even better.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *