I have been wanting to run my own mailserver at home for some time now. I don't necessarily absolutely need such a thing but it would be very useful to have as I am working running my own business now and really I need a more professional email than just a personal Hotmail account.
I have been working on this on and off for quite a few weekends and haven't managed to make much progress. I started by following one of Luke Smiths guides, which is available on YouTube. (Link will be attached at the end of this post.)
Here is an overview of what I have tried to do:
- Install required software on a Raspberry Pi. Setup required port forwarding on my home network. Discovered that my ISP router prevents port 25 from being forwarded, so tried using 2525 instead. (Read online that 2525 was a common alternative port if 25 is blocked. Not sure how valid this information is.)
- Tried moving R-Pi to be directly attached to ISP router rather than being behind another router. (pfSense box)
- Put ISP router into modem mode, passing everything to pfSense. Enabled port forwarding and required firewall rules for traffic. (See below) Of course I put the R-Pi back on one of the pfSense interfaces when putting the ISP router into modem mode.
Here's a list of ports I am currently forwarding:
- 25 (SMTP)
- 143 (IMAP)
- 465 (SMTP/S)
- 587 (SUBMISSION)
- 993 (IMAP/S)
Being perfectly honest about this I don't understand what all of these are for. I understand some of them are secure versions, eg: SMTP/S is the secure version of SMTP, and I understand that some are for communication with other mail servers and some are for communication with other mail clients. This is about the limit of my understanding.
Additionally I have installed postfix and dovecot. Again, I am not 100 % certain on what each of them does, I believe one is a piece of software which moves mail to/from different mail servers, and the other is a server which allows email clients to login and send/retrieve mail.
I am using Epik as my domain name registrar. I have set the MX records and ip addresses.
If I login to a remote machine on a different network (such as a University computer) I am able to run dig with my
mail.mydomainname.comand obtain the expected ip address.I can also use nmap to see that the ports listed above are open.
I tried running this mail diagnostics tool https://mxtoolbox.com/diagnostic.aspx. It produces a warning for the SMTP banner. I am not sure if this is a problem or not.
Using this tool, it does not work for
mydomain.com, and only works formail.mydomain.com. I don't know if this indicates an issue?
There are a few things which don't work.
Firstly, until today I was able to get Thunderbird to connect to my R-Pi. Now I can't. My IP address has changed, but I have updated this on Epik, so I don't understand why there is suddenly some problem with this. (Again, I have no idea what steps to take to diagnose this - no errors are produced, other than I cannot connect to download/sync mail.)
I was able to send mail from my mail server to other servers. (For example outlook or gmail.) But I was NOT able to send mail from gmail or outlook to my own mail server. I assumed this was due to not being able to forward port 25. But again I do not know for sure.
Sorry for the absolute wall of text here. I've been working on this for weeks using up most of my free time trying to get this to work and I seem to be getting no where. The frustrating thing is that I can get things like ssh to work without issue. Also the fact that I have no idea how to start with diagnostics isn't helping either.
So my question is: What tools are available to help me diagnose this issue and what further steps should I take to diagnose this?
Currently I am aware of
- nmap to do port scans to check for a route to a port where some server software (eg postfix/dovecot) is listening
- this online mxtoolbox thing, althought I don't fully understand what it does
Any help / advice appreciated.
It could be that Luke gave me bad advice. Perhaps I should be using another resource as my reference for how to setup a mail server instead of some guy on YouTube?
https://www.youtube.com/watch?v=3dIVesHEAzc
Edit: Further Info
I have found that if I put in the local ip address into the Thunderbird configuration, then the "Re-test" button indicates that the setup config is ok.
However if I put in mail.mydomain.com, the setup fails. Does this indicate a DNS setup issue?