iRedMail. Adding a catch-all account

One customer once asked to set up a forwarding of all email from non-existent addresses in his domain to a specific email address, this is usually called catch-all or luser_relay in postfix.

Let’s say we have an existing email, test@example.com, and we want to redirect all mail from non-existent accounts in the ixnfo.com domain.
This can be done through iRedAdmin-Pro, but in my case there was only free iRedAdmin, then I will show you how to do it through SQL queries.

Let’s connect to the MySQL server:

mysql -u root -p

Let’s select the vmail database:

USE vmail;

Let’s add a catch-all account for a specific domain (for example, all email from non-existent addresses of the ixnfo.com domain will be forwarded to test@example.com):

INSERT INTO forwardings (address, forwarding, domain, dest_domain)
                      VALUES ('ixnfo.com', 'test@example.com', 'ixnfo.com', 'example.com');

Let me give you another example, let’s say one mail is created for the domain test@ixnfo.com and we want to redirect all emails to it for nonexistent addresses of this domain:

INSERT INTO forwardings (address, forwarding, domain, dest_domain)
                      VALUES ('ixnfo.com', 'test@ixnfo.com', 'ixnfo.com', 'ixnfo.com');

Let’s see the added entries in the forwardings table:

SELECT * FROM forwardings;

Here’s an example of deletion:

DELETE from forwardings where forwarding = 'test@ixnfo.com' AND id=12;

See also my articles:

Leave a comment

Leave a Reply