Skip to content

Using a subdomain for inbucket (with mailcow)

speendo edited this page Jul 13, 2020 · 1 revision

If you have a "regular" mail server running (let's assume on <yourmailserver.net>) and want to use inbucket for a subdomain (say <spam.yourmailserver.net>) you will soon realise, that this is likely not working by default.

Your regular mail server catches all the mail coming to *.yourmailserver.com and doesn't know what to do with your subdomain <spam.yourmailserver.net>.

A sidenote on Postfix

If you are using Postfix as your mail server, you have to make some changes in the postfix configuration. On Serverfault here is a very brief write-up on what to do (LINK).

Mailcow

Administrating a mail server can get a little frustrating - there are a lot of things to take care of to make your mail working and to avoid spam filters. I recently switched to mailcow, a preconfigured docker service, with a fancy web ui. For me, this makes things a lot easier.

Mailcow already provides temporary e-mail-addresses out of the box. However, a temporary e-mail-address is not exactly a disposable e-mail-address and therefore inbucket is nevertheless a sensible service on my server.

To inform mailcow on how to deal with mails going to <spam.yourmailserver.net> you have to do the following:

  1. Go to mailcows configuration page and log in as admin user

  2. Select "Configuration > Mail Setup" in the top menu

  3. In the tab "Domains" add a new domain "<spam.yourmailserver.net>". Unselect "Global Address List" (This is not crucial but you will probably not need it on inbucket), and select "Relay this domain" and "Relay all recipients". Hit the button "Add domain only"

  4. Go to "Configuration > Configuration & Details" in the top menu

  5. In the tab "Routing" scroll down to "Add transport"

  6. In "Destination enter <spam.yourmailserver.net>

  7. In "Next hop" enter <inbucket's IP address>:<inbucket's SMTP port>. As I run inbucket as docker service, the IP address is the docker server's IP address. Also for docker, the default SMTP port is 2500 (unless you changed or re-routed it like I did).

  8. You can leave "Username" and "Password" empty, but make sure you select "Active" before you hit "Add".

  9. Done. Send a mail to test@<spam.yourmailserver.net> to see if everything is working as expected. It should be present in inbucket a few seconds later.