No, that’s it. I am f#*&@-ing done. I went from gmail to tuta to proton. Now I hear something like FastMail. Some say privacy, some say security, but what they never say is corpos gonna corpo.

No, I am done using third party services. This may be a Sisyphus task, but I want to self host a mail server even if 60% of it goes to another person’s spam.

I’ve heard about Dovecot and some other services. While searching YouTube, I came across a defunct channel that still has this old video that gives instructions to selfhost email: https://www.youtube.com/watch?v=9zP7qooM4pY

Cherry on top would be to have as many parts with the GPLv3 license as possible.

Any guidance or instructions would be greatly appreciated. I have a domain name and I am currently hosting a small webpage for fun. Nothing serious.

  • kalpol@lemmy.ca
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 hours ago

    So what I did has worked great.

    Life is way easier if you are running something like opnsense as your firewall. Then you have really good spam filtering available at the firewall through e.g. pfblocker.

    I learned Exim. It’s super configurable and stable. I got a VPS and put another instance of pfsense on it with wireguard tunneling back home to my dynamic IP (which pfsense handles via dyndns). The static IP and VPS costs about $5 a month. Exim lives on the home machine and haproxy on the remote VPS handles email receipt and forwarding.

    Only a few problems with the IP when new getting blocked by Google. I had my SPF/DKIM/Dmarc set up and requested unblocking and they did it in several days, and that was all.

    The advantages here are that you can easily update without changing configs, the wg tunnel is stable, and your host remains on your own server, and pfsesne along with spamassassin and the native routing and session tools in Exim kill most spam.

    Some investment up front can really pay off. Oh also you can use ACME on the pfsense instance to handle all your certificates through let’sencrypt automatically.

  • pez34@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 hours ago

    I’ve been running my own email server since around 1996. I go old school with sendmail and dovecot on linux, but sendmail isn’t for beginners…postfix or exim are easier to configure with lots of add-ons available, and others have suggested several other MTAs that are probably just as good. Nowadays its more work to get started with sending emails (w/o getting rejected immediately as spam) since you’ll need to configure DMARC, DKIM, and SPF along with reverse DNS, but not that hard if you’re somewhat technical and willing to learn. The big providers get to set the rules here, and they’re incentivized to make it hard for a self-hoster, because that also makes it harder for spammers. The first few weeks your emails will get directed to spam folders until the providers learn your domain and associated IP address aren’t from a brand new fly-by-night spammer but it’ll taper off, you just gotta keep at it.

    The biggest annoyance and work honestly is on the receiving side, with all the spam filtering work you’ll need to do once your email gets onto the spam lists. The big email providers have entire teams set up for this. You’ll also need to set up your own DNS resolver to use spamhaus and spamcop blacklists (which is what everyone uses because they’re so good), because all the public resolvers (and the shared resolvers at your VPS or cloud provider too) are already hitting them so much they get rate limited. Good news is once you get those blacklists configured correctly that’ll take care of probably 80% of the spam, then a standard open source package like spamassassin or spamprobe normallys gets most of the rest.

    Another reality is that your home residential connection won’t let you send email from their network; this really reduced spam as people’s compromised machines can’t be used to send spam anymore. However, there are providers out there intended for home self-hosters that will route you a static IP that you can configure reverse DNS on and enable outbound port 25 connections. https://getrealip.net/ is one of them, see their guide for self-hosting email here: https://getrealip.net/guides/self-host-email-server/

  • binarynoise@feddit.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 hours ago

    I’m using maddy. It bundles everything in one program so you only configure one service and not like 5. I’m using it mostly for receiving mail my infra sends me though.

  • The Stoned Hacker@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    6 hours ago

    As someone who has been self hosting my email for years I have some advice: be wary, this is a difficult service to build well and if you dont then maintenance will be difficult, you risk exposing your data publicly, and your mail won’t be delivered. But if you stick with it you will find it to be incredibly rewarding and not really as much of a hassle as everyone thinks.

    If you want something easy that will get you 90% of the way there and make the remaining 10% easy, I cannot recommend mailinabox or iredmail enough. I used MIAB for the first few years I hosted my own mail server, and it did well enough that I’d recommend it if you just wanna host your own mail. However I would recommend against these all in one solutions if you want to actually control, configure, and understand how your mail server works. I was given the same advice when I started and after a year and a half I was working on replacing MIAB with something I built myself.

    Where I would recommend starting is the ISPmail guide1. This is one of the most comprehensive and well written guides for building a mail server. It does not cover everything, but it will get you a secure and reliable mail server with high deliverability if you keep your domain’s reputation clean. This means making sure your emails arent being blocked and that everything else is adequately secured so that no one blocks your domain; afaik I have only been blocked once when I was first starting out, and I haven’t had any issues since getting off that blocklist. The guide covers DKIM (which require DNSSEC as well), SPF, and DMARC. The guide does not include setting up MTA-STS, Fail2Ban, email auto configuration (i recommend automx2), nor webmail or DAV (i recommend Nextcloud), but none of these things are necessary for having good deliverability or a working mail server.

    If you choose to continue, I wish you well and hope you have fun becoming one of the increasingly few self hsoted mail admins left!


    1. https://workaround.org/

  • Theoriginalthon@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 hours ago

    Fuck yeah! Right first things first are you prepared to learn new stuff and know how to read documentation?

    If you have never hosted email before I want you to go away and look at these topics before even starting. It will help you understand what’s going on Postfix, dovecot, SMTP, DNS records, SPF,DKIM, dmarc, fail2ban, what an open relay is, let’s encrypt, how to use lets encrypt for mail servers, email blacklists.

    Once you get started setting up a server mxtoolbox.com is going to be your new friend.

    Although I’ve never used it there is a mail server in a box https://github.com/mail-in-a-box/mailinabox which just installs and configures everything.

  • Reven@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 hours ago

    I’ve been hosting my email for about 15 years now. And now it’s used by 7 people as their daily. And yes, there have been some issues. And yes, it’s complicated. But it’s also freeing and fun. If you really want to do it, go ahead and learn the ropes. I’ve never understood the people that say “OMG, you never want to selfhost that!”. I have a VPS, and you really don’t need a beefy VPS at all for a couple of accounts and some aliases.

    VPS is a must (or co-location, but that’s more expensive). Check out VPS providers to see which are tolerant with email and how “clean” their IP reputation is. I have the Postfix+Dovecot stack, but I’m already eyeing Stalwart, because the LTS distro on my server is reaching it’s end-of-life, and if I have to go through the setup again (the switch from dovecot 2.3 to 2.4 is bumpy), I’d rather try something new. Btw, I don’t have an IT background, just been tinkering for a long time.

    So buckle up and start planing.

  • Kuadhual@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    17 hours ago

    As someone who used to manage a mail server, I would not do it ever again. Well, Installing and configuring them IS the fun part. Managing them, making sure the domain is not blacklisted, checking spamhaus, getting asked why I don’t reply their email while it was google who dump the email to the spam folder was not fun.

  • chewypoops@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    13 hours ago

    This is one of those things that everyone wishes they could self host until they try to, and then they regret it and desperately need to switch back.

  • stom@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    13 hours ago

    AWS Lightsail VPS, install Virtualmin. It’ll configure dovecot and postfix for you. You can use roundcube webmail (they have an installer) or Thunderbird right out the box. Setup DKIM, SPF, and DMARC. Request your PTR/rDNS from AWS and you shouldn’t get issues. I’ve run this for years and never had an issue with mail being blocked which wasn’t my own server blocking others.

    • Buck@jlai.lu
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 hours ago

      This may be a very nice proposition, but I, personally, would never give admin rights to a rando from the internet on what is to become my mailbox soon after…

  • Magiilaro@feddit.org
    link
    fedilink
    English
    arrow-up
    4
    ·
    19 hours ago

    Hosting your own mailserver can be fun but can, and very likely will be, come with a huge can of worms. I host my own mailserver for a handful of domains for roundabout 20 Years now (on a rented virtual server with a “datacenter ip address”) and still run into issues from time to time. Most of those could have been prevent if I had not slept on things like DMARC, DKIM, DANE and such, it is very important to always be aware of new security mechanisms and to implement them.

    I would recommend against trying to run a public mailserver on your local server with a residential ip address, because you can’t set a ptr for those and ranges/networks from ISP are all on filter lists, so it is borderline impossible to get any mails delivered.

  • MuttMutt@lemmy.world
    link
    fedilink
    English
    arrow-up
    41
    arrow-down
    1
    ·
    1 day ago

    Here is the issue with self hosting email. Residential ip’s are pretty much verboten from being able to receive email by the big companies. That means everything you send it will be automatically deleted. That’s if you can even set it up to work as most ISP’s block the needed ports. No a VPN won’t fix this or solve the problem. You can receive with no problem but to send you will need to use something like SMTP2go or if your ISP is capable (and willing) they can send.

    If you want someone to blame look to the Spammers and Hackers of the world.

    I’m in the process of moving everything I do to self hosted as much as possible. Email is a bigger nightmare than web hosting at home. The only other option I can find (for self hosting) is collocation of your server in a data center.

    • Daniel Quinn@lemmy.ca
      link
      fedilink
      English
      arrow-up
      12
      ·
      1 day ago

      Surely you get set up everything you need on a VPS though, right? You can even rent a Raspberry Pi in a rack in the UK if you want and that’d work for email, right?

      • MuttMutt@lemmy.world
        link
        fedilink
        English
        arrow-up
        10
        ·
        1 day ago

        Correct, a VPS or a Raspberry pi in a data center can be used. You would still need to install the software and configure it.

        • NotSteve_@lemmy.ca
          link
          fedilink
          English
          arrow-up
          3
          ·
          1 day ago

          Wait, I know colocation in datacentres is a thing but can you actually collocate raspberry pi?

    • cpbsy@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      For $3 a month, forwardemail will forward both inbound and outbound email for you. You’ll still have a lot of work setting up DNS entries and spam filtering, though.

  • hemmes@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    ·
    1 day ago

    I’ve self-hosted email for over 25 years. Much has changed, but the basics are still the same - and it’s not difficult.

    The first thing I would ask though is what are you looking to spend, before any required hardware? Meaning just the reoccurring provider fees, whether that’s your broadband ISP provider with static IP service added on (this almost always requires a business account, also very easy to do), or a cloud VPS provider (probably cheaper)?

    • Korthrun@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 day ago

      Thank you! I don’t get why these threads are always so full of FUD.

      Once I setup email it’s been little to no maintenance. Very “set it and forget it”. I check my logs after I see the software updated by my package manager to catch breaking changes. Which are super rare. I’ve had to increment a version number in a config a time or two.

      • pulsewidth@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        24 hours ago

        There’s no FUD, just D.

        Hundreds of us here on Lemmy have hosted our own email before, some (like me) for over a decade. We share our opinion that it’s on balance not worth it as (from experience) it’s a massive pain in the arse to keep yourself off blacklists. You do you though.

        • Korthrun@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          1
          ·
          9 hours ago

          I had to do a thing with Google one time to validate my IP so that Gmail didn’t mark mail from my server as spam. I’ve never had to do any sort of blacklist removal process. I’ve been hosting email for my own domains since 2006.

          What gets y’all on blacklists?