Author Topic: catch unrouted emails only?  (Read 11072 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
catch unrouted emails only?
« on: October 11, 2015, 05:53:14 AM »
hi all, i hope some one can help me in here, my problem i have many unrouted email address and i need to catch it all, but when i use the catch all feature, it catch all the emails going to the domain not only unrouted ones, is there any solutions out there?

thanks
mark

Offline
**
Re: catch unrouted emails only?
« Reply #1 on: December 28, 2015, 03:42:46 PM »
You can setup aliases for the ones you don't want going into the catchall mailbox , and deliver the mail to their own mailbox or send them off to another domain.

Offline
***
Re: catch unrouted emails only?
« Reply #2 on: December 16, 2016, 06:55:29 AM »
I just realized that this problem also happen to my cwp.
But as cwp doesn't create 1 to 1 alias as default when creating user/mailbox, this gonna be problem forever..

I hope, sql alias table for own mailbox will automatically created by cwp, with cwp Pro at least.

Offline
***
Re: catch unrouted emails only?
« Reply #3 on: December 21, 2016, 10:35:50 AM »
Found solution
first, create mysql map file, in my case i create :

Code: [Select]
/etc/postfix/mysql-virtual_alias_default_maps.cf
Will contain :
Code: [Select]
hosts = localhost
user = postfix
password = ************
dbname = postfix
query = SELECT username FROM mailbox WHERE username='%s' AND (active = '1' OR active = '3')

Then edit this file :

Code: [Select]
/etc/postfix/mail.cf
Find this line :

Code: [Select]
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf, regexp:/etc/postfix/virtual_regexp

Change to :

Code: [Select]
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias_default_maps.cf, proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf, regexp:/etc/postfix/virtual_regexp
Restart postfix, and and create catch-all alias, will not ignore existing mailbox...

Offline
*
Re: catch unrouted emails only?
« Reply #4 on: February 14, 2018, 01:19:24 PM »
Worth mentioning that this rule will get lost if you rebuild postfix.

A better solution is (perhaps) to create aliases/forwarders for the accounts you don't want to be caught.

I.e. we have a catch-all for *@example.com, and accounts for john@example.com and sarah@example.com.

If you create a forwarder for each of john and sarah as follows, then these will take precedence over the catch-all rule and their mails will be delivered to their inbox instead of the catch-all.

john@example.com > john@example.com
sarah@example.com > sarah@example.com

HTH