How to run a mail server at home?

4

1

Is it possible to set up a mail server at home, if all I know is basic cable and Internet?

Let's say I have domain XYZ.com, which points to a hosting service. Can I configure that to redirect all incoming emails to my username@IPaddress? I have no problem setting up port forwarding of course.

How about outgoing emails? Can I send them directly from my home IP address, contacting a remote mail server for delivery?

Thanks.

Warren

Posted 2012-08-16T13:56:53.077

Reputation: 249

For many people it is impossible to run a mail server at home because most ISPs block port 25. The block is for spam. – None – 2012-10-25T14:06:17.307

Answers

4

Let's say I have domain XYZ.com, which points to a hosting service. Can I configure that to redirect all incoming emails to my username@IPaddress? I have no problem setting up port forwarding of course.

Basic steps:

  • Accept/forward incoming connections on port 25 to your mail server.
  • Make your domain's MX record point to your home IP address.
  • Install and configure a MTA (message transfer agent) like Postfix.

How about outgoing emails? Can I send them directly from my home IP address, contacting a remote mail server for delivery?

I'm not sure if I understood this part well. You can either send them directly from your IP address or through a remote mail server.

In theory, sending directly will work with the MTA. In practice, it's quite possible that your ISP is blocking outgoing connections on port 25 (to prevent spam) or that your IP os on some blacklist (check here).

Sending emails using a remote server can be done by the MTA or any email client.

Dennis

Posted 2012-08-16T13:56:53.077

Reputation: 42 934

@DarthAndroid Do you have proof or reference for this reverse domain thing? For example one of the gmail's MX servers IP resolve to lt-in-f26.1e100.net. All others resolve to something similar or the address of their local data center's name. I don't think this reverse domain thing is relevant in rejecting the mail. – Calmarius – 2018-05-16T22:22:29.143

@Calmarius And lt-in-f26.1e100.net resolves to that IP. This match is what spam filters are checking for. – Dennis – 2018-05-16T22:57:28.797

@Dennis so it's not checking the name... But isn't all reverse domains point back to the same IP by definition? – Calmarius – 2018-05-17T08:25:21.397

@Calmarius No, that's not how rDNS works. google-public-dns-a.google.com resolves to 8.8.8.8 and 8.8.8.8 resolves to google-public-dns-a.google.com. Anyone can buy a domain and point it to 8.8.8.8, but that doesn't change 8.8.8.8's rDNS record. Matching DNS and rDNS records hints that the domain and IP are controlled by the same entity.

– Dennis – 2018-05-17T14:43:19.607

It's also not a fair system. GMail, Outlook, Yahoo, Hotmail, etc. are well-known providers and other email providers will often whitelist them. That's not the same for any old email server. – Darth Android – 2018-05-17T15:30:26.977

@Dennis All IP addresses that is served by my ISP resolves to catv-xx-xx-xx-xx.catv.broadband.hu when I reverse lookup it, where xx-es are the octets. And they also resolve back to the given IP address. The wikipedia you linked says that spam filters match against these generic patterns and block mails based on that. It has nothing to do with the IP they resolve into. And that's indeed a problem for home mail servers... – Calmarius – 2018-05-17T15:31:04.407

@Calmarius Spam filter (can) also check for generic hostnames, yes. But without rDNS, you could just tell the other server you domain name was something else. Forward-confirmed reverse DNS checks prevent this. – Dennis – 2018-05-17T15:38:17.330

1Also, you might find it difficult to set up a reverse DNS record for your home IP. Many mail servers will reject mail where the domain of the sender doesn't match the reverse DNS record for the IP that is sending the email. – Darth Android – 2012-08-16T14:13:31.600

That's a good point, @DarthAndroid. In case it's not clear from my post, sending emails directly from your home IP generally isn't a good idea. If you can send them, there's quite a chance they will be treated as spam. – Dennis – 2012-08-16T14:15:23.117

Exactly. I personally use Google Apps to manage email for my personal domains. It's free, pretty easy to set up, and has great standards support (POP3, IMAP, web interface, etc.) that's available. – Darth Android – 2012-08-16T14:19:11.997

Alos be aware that some ISPs block traffic to mail or web ports(and others) so home servers will not work. – Dave M – 2012-08-16T16:28:07.953

I have found that both of my domain providers prevent using my IP address in the MX record. – Warren – 2012-08-17T11:20:56.173