How to run a mail server at home?

5,543

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.

Share:
5,543

Related videos on Youtube

Warren
Author by

Warren

Updated on September 18, 2022

Comments

  • Warren
    Warren over 1 year

    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.

    • Admin
      Admin over 11 years
      For many people it is impossible to run a mail server at home because most ISPs block port 25. The block is for spam.
  • user1984103
    user1984103 over 11 years
    Also, 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.
  • Dennis
    Dennis over 11 years
    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.
  • user1984103
    user1984103 over 11 years
    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.
  • Dave M
    Dave M over 11 years
    Alos be aware that some ISPs block traffic to mail or web ports(and others) so home servers will not work.
  • Warren
    Warren over 11 years
    I have found that both of my domain providers prevent using my IP address in the MX record.
  • Calmarius
    Calmarius almost 6 years
    @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.
  • Dennis
    Dennis almost 6 years
    @Calmarius And lt-in-f26.1e100.net resolves to that IP. This match is what spam filters are checking for.
  • Calmarius
    Calmarius almost 6 years
    @Dennis so it's not checking the name... But isn't all reverse domains point back to the same IP by definition?
  • Dennis
    Dennis almost 6 years
    @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.
  • user1984103
    user1984103 almost 6 years
    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.
  • Calmarius
    Calmarius almost 6 years
    @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...
  • Dennis
    Dennis almost 6 years
    @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.