How to send and receive emails from and to unlimited domains for free
Written on .
Assuming you already own those domains, we will use seznam.cz to be able to send and receive emails from/to unlimited domains. So if you own soptik.tech
, you can receive mails at anything@soptik.tech
and send mails from there as well.
Czech mail provider, seznam.cz, offers neat service for free. It's the possiblity to send emails from unlimited number of domains, without the need to pay anything.
When you create account, you have the option in settings to setup alternative email addresses. When verify that you own the email (by typing security code that is sent to that address), seznam allows you to send any emails from those domains. And it's for free, you don't have to pay anything.
However, seznam doesn't offer receiving mail from those domains without paying for premium version. But we can get around this by setting email forwarding on your own server.
Setting up email forwarding
First of all, point your domains to your server. You want to set up MX record
, which is used to know where to send emails. For example, MX record for this website looks like this:
$ dig MX soptik.tech ;; QUESTION SECTION: ;soptik.tech. IN MX ;; ANSWER SECTION: soptik.tech. 7200 IN MX 10 soptik.tech. ;; ADDITIONAL SECTION: soptik.tech. 6652 IN A 167.71.35.104
If you wait a bit for those changes to propagate, all mails sent to anything@soptik.tech
will reach this server.
Nothing is easier than capturing those emails and forwarding them somewhere else.
We will use program called postfix
, it should be in all repositories by default. Don't forget to start and enable postfix service.
I won't go through installation, but once it is up and running, we have to set up email forwarding. Configuration should be in /etc/postfix
.
First of all, we will edit /etc/postfix/virtual
, where we can setup where will all the received emails be sent. The format is /regex/ target@email.com
. For example my configuration looks like this:
# /etc/postfix/virtual /^admin@/ my.email@example.org /^webmaster@/ my.email@example.org /^security@/ my.email@example.org # Catch-all if we didn't match anything above /@soptik.tech$/ my.email@example.org /@prenoc.cz$/ another.email@example.org
Then we need to ask postfix
to use this file. Add those lines to /etc/postfix/main.cf
:
# main.cf # (generated configuration) # Your domains that should be forwarded virtual_alias_domains = soptik.tech prenoc.cz virtual_alias_maps = regexp:/etc/postfix/virtual
Then we rebuild forwarding map with postmap /etc/postfix/virtual
, restart service, and everything should work like a charm.
You can verify if the configuration is applied with postconf -n | grep virtual
. Now if you send an email to your domain, it should be forwarded to your email provider. I didn't test this for gmail, but it works without any issues with seznam, which is the one we will use.
Troubleshooting
Sometimes you might think that it's taking too long for an email to arrive and you want to check if there is an issue with your setup. The simplest thing to do is read /var/log/mail.log
, which contains all the info you would possible need to troubleshoot whatever went wrong.
Setting up seznam to send emails through your domain
Seznam offers paid program which takes care of everything, but we don't really want to pay for it. So we will use what was given to us for free.
Create new account and go to Settings > OdesÃlatel
(might be Sender or General, it's the first one). There is a form which allows you to add more email addresses that can be used to send mail. As far as I can tell, it's unlimited. Simply add something like admin@example.com
and wait for confirmation email. It should arrive to your email because of the redirection we set up earlier. Once you type the confirmation code/click the confirmation link, you will be able to send emails directly from your domain, for free.
Epilogue
This is an update as of 2020-08-27. Ehm, as it turns out, this isn't needed at all. The service 'seznam profi', that I successfully avoided by doing the magic with postfix above (as I thought it is payed), is actully, well, free. So. Ehm.
pacman -Rsn postfix
You just setup MX to point to seznam and that's it. Thanks, Prokop.