CyberHosting

Email Catch All Solution / Proper Method

Evening all,

I appreciate there's a feature request in place and the developers are looking into / adding the feature but has anyone managed to get a working 'catch all' email solution in place (in the mean time / temporary solution until a CyberPanel feature is added) within the CyberPanel configuration?

I've followed a few guides and have tried to mash it together with the CyberPanel installation but i'm getting nowhere unfortunately.

Currently i've created a catch all table, e_catchall with the structure and data like -
+----+---------------+--------------------+---------+
| id |    source     |    destination     | enabled |
+----+---------------+--------------------+---------+
|  1 | @example1.com | [email protected] |       0 |
|  2 | @example2.com | [email protected] |       1 |
|  3 | @example3.com | [email protected] |       1 |
+----+---------------+--------------------+---------+

And then have a Postfix config, mysql-virtual_catchall.cf file as follows -
user = USERNAME
password = PASSWORD
dbname = cyberpanel
query = SELECT destination FROM e_catchall WHERE source = CONCAT('@','%d') AND enabled = 1
hosts = localhost
* used '%d' as i found '%s' would usually pull in the full email address rather than just the domain; although i have noticed '%d' sometimes equals the senders domain (??).

And i've changed the alias maps line within main.cf to -
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_catchall.cf, mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf

In theory, certainly in my head, this should work but Postfix is throwing 554 5.7.1 Relay access denied; errors.

I've attached a link to a Pastebin of the full main.cf (not standard, used on other production servers) in case it helps but does anyone have a reason why my implementation doesn't work or have a proper/better solution that works?

This is about the only thing that's stopping me using CyberPanel properly on my productions servers so any help will be greatly appreciated! :)

main.cf - https://pastebin.com/jDm0svdX

Comments

Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!