Back to blog
Feb 2024·4 min readAI-translated

Mail Management / Spam Protection

#email#qmail#mailforwarding

I hate SPAM. You can probably tell from the number of blog posts (you could almost think the whole blog is only about spam). By now, though, I've found a relatively perfect way to avoid SPAM, and would like to share it with everyone.

My web domain is - as you can easily see - devdave.de. Via a DNS entry it points to a mail server hosted at Uberspace. At Uberspace I've set up a catch-all and have all emails forwarded to my private mail account at Gmail.

This leads to the situation that for every online/offline form I fill out, I can provide a dedicated email address.

A good example is Kickstarter. For a long time kickstarter@devdave.de was stored there.

Emails that Kickstarter sent me were first routed via my DNS to the Uberspace MX. Uberspace forwarded the mails to my private account.

Then it happened as it had to happen. After I had backed one or two projects, the address fell into the wrong hands. Accounts were created for me at BackerRock, and suddenly strange spam from dubious Chinese (junk) retailers started arriving at this email address. That way I could directly trace where the spam was coming from, i.e. which email address had been compromised.

Fortunately, Uberspace also supports qmail. With qmail, individual filter rules can be created at the file system level. To block the spam to kickstarter@devdave.de, I simply created a qmail file that declares the mailbox kickstarter@devdave.de as #5.1.1 (mailbox not found) and returns a corresponding reply to the sending mail account. At Kickstarter I changed my email address to a valid one and could thus get rid of the "compromised" address.

Another advantage is that - as soon as a provider really starts sending spam - I can immediately find out where the spam comes from, since every provider got its own dedicated email address from me.

But, how to do this?

Step 1: Get a domain

That should be pretty clear. You need your own domain for this approach. Let's simply call it "myfancymaildomain.at"

Step 2: Create an Uberspace account

It doesn't have to be Uberspace, of course, but at 5€/month (or the pay-what-you-want principle) they're relatively cheap and ideal for this purpose, since the MX is already fully set up there and qmail support is offered.

Step 3: Add the domain at Uberspace

Now you log in to your Uberspace via SSH and run the following command, which registers your domain as a mail domain at Uberspace.

uberspace mail domain add myfancymaildomain.at

The command returns values that you have to store with your domain provider. You can find Uberspace's documentation on the command here: manual.uberspace.de/web-domains

Step 4: Adjust the DNS entry

The values given by Uberspace now have to be stored with your domain provider (in my case that's Namecheap.com). Also remember the DKIM and SPF entries! Without DKIM and SPF entries, the mails you send will most likely be flagged as SPAM.

See: DomainKeys Identified Mail and Sender Policy Framework

Step 5: Set up the catch-all at Uberspace

In your Uberspace dashboard you go to Mail, add a new address and enter your (private) mail account as the forwarding target. As the address, a

+

must be entered and saved.

Step 6: Sending emails

To also send mails from your domain, you set up another mailbox. Set up a mailbox as in step 4, but this time don't enter a forwarding target, enter a password instead. Mails to this mailbox are not forwarded (!) but you can access your mail account via webmail.uberspace.de. That's not always so convenient, since you probably don't want to check two accounts (your private one and the newly created one). But there's a solution for that too! Most mail providers offer fetching emails via POP. So you can probably instruct your (private) mail provider to fetch emails from the newly created account remotely via POP. The same goes for SMTP. In Gmail you choose Settings -> See all settings -> Accounts and Import (mail.google.com/mail/u/0/#settings/accounts) Under "Send mail as" you can set it up so you can send mail with your newly created account. Under "Check mail from other accounts" you can have mail fetched remotely via POP.

Step 7: But what if I get spam?

Easy. You go back to your Uberspace dashboard under Mail. Suppose you get spam at compromised@myfancymaildomain.at

Then you create a .qmail address (at the very bottom of the page). The address is the mailbox name (without domain) that is compromised, in our case compromised. As the delivery rule you enter

|preline /usr/bin/exit 67

This causes mails sent to this address to be answered with the status code #5.1.1 - Mailbox not found. So for the mail sender it looks as if the mailbox doesn't exist (and hopefully they give up :-))

NewerPython3 - Renaming Files With the Same NameOlderThe Importance of Accessible Web Design: A Gateway to Inclusivity and Usability