So, I’m trying to set up a self-hosted mastodon instance, and of course this requires an email service. Self hosting one is not an option, because of anti-spam stuff, or so everyone says. The recommendations are to use services like mailgun or postmark, but there’s one thing I don’t really understand:
All these services require verification of an email to be able to send from it. For example, if I want to use noreply[at]mydomain.com
with mailgun, I need to click a link sent to that address, which to me feels like a catch-22. How can I receive that email if I don’t have the email service set up yet? Do I have to set the domain up with some private email service (protonmail, tuta…) first?
Any help is appreciated, I’m pretty new at this.
Edit: Alright, so it seems that Mailgun actually doesn’t require this weird confirmation email, just dns records. The first one I tried, SendPulse, did. Postmark requires an email from the domain at signup. Hope someone else can learn from this.
It’s not that self hosting email is impossible, just that it takes a lot of work to set up correctly and keep up with spam and abuse prevention. You can literally just fire up postfix, add a DNS record, and you’re up and running. The problem is none of the major providers will talk to you until you add SPF, DKIM, and DMARK (including the appropriate DNS records), and if you don’t have controls in place to immediately shut down any spammer attempts then those services will blacklist you. It can get exhausting after awhile, especially dealing with providers like Microsoft who make you go through impossible hoops to get access to monitor their view of your domain, but then their tools don’t actually show any incidents which cause them to blacklist you.
You might be able to just set up a quick local mail server for your domain in order to receive those confirmation messages, but I would suggest taking a closer look at exactly what you’re trying to get set up for, or maybe contact the companies directly. You might not actually be in the right area to sign up for a service to handle all the email for your domain, and a company rep could possibly point you to the right spot or explain to you how you’re supposed to receive a confirmation email when no email service exists yet.
Idk what mailgun is doing, but many services verify your domain by having you add a specific TXT DNS record or automatic verification by logging into Cloudflare (if that’s where your Domains at) or something
Do you have any specific recommendations?
ETA: A lot of the services I’ve seen even require signing up with a custom domain, meaning I can’t even get past that stage (well, I could use my personal domain I guess, but I’d rather not).
Are you trying to avoid taking out another domain and use a service that offers free subdomains so it’s like noreply[at]yourinstance.service.com?
I don’t know of any specific service, but I would just take out another domain, they’re pretty cheap for .com and .net over at Cloudflare
There are a few all-in-one solutions out there that make selfhosting Email easier. “Mailcow” for example if you’re using docker.
Maybe your provider also offers you mail.
I think you can also register an external mail service. For example register an email address with gmail.com and set SMTP_SERVER SMTP_LOGIN and SMTP_PASSWORD etc accordingly. You then need to set SMTP_FROM_ADDRESS to the gmail address. I dont think it’ll work with noreply@mydomain.com if you’re doing it like that.
I use protonmail + porkbun domain + postmark, and it works great.
Some domain registrars have cheap or even free email services, OVH for example gives a single email address for free with each domain, which is very likely to be sufficient for most self-hosting needs.
I use Mail-in-a-Box on a small VPS. Have been doing so for about 10 years. It takes care of basically everything.
Last year I subscribed to a small-time email provider, anydomain.net, because I got tired of playing whack-a-mole with services blocking my entire subnet due to spammers on the VPS. All told I probably spend ~US$20 per month to host it.
theres the SMTP sending/relay service, and then theres your management of the email domain.
for example, i use Amazon for my hosting services including SMTP. so when my instance emails outbound, its using amazon’s service as a relay for my domain. my domains are entirely run/manged through other services… mostly Proton.
so you’d setup a domain with email on an email provider somewhere, then set your instance to use that domain when sending outbound, which could require auth by your local hosting provider, or special provisions at your email service to accept the relayed email.
youre going to run into issues authorizing the relay needed to send outbound from your instance. amazon was a bitch
if I want to use noreply[at]mydomain.com with mailgun, I need to click a link sent to that address, which to me feels like a catch-22. How can I receive that email if I don’t have the email service set up yet?
In this case mailgun is a email sending service, so no matter what you’d need another email service to receive email.
I use sendgrid, it only requires some DNS entries for Domain Authentication. Also regarding the catch-22, if you use Cloudflare for DNS, you could use their email routing to forward incoming mails to Gmail