Thursday, August 16, 2018

Initial default/catch-all forwarder destination = FAIL

If you set this to "Fail", then emails sent to non-existing email accounts on the domain will be bounced back to the sender rather than try to deliver to the user's default email account. This will only apply to new accounts. Any previously existing accounts will need to have this changed in /etc/valiases from the following:

Code:
*: username
To the following:

Code:
*: :fail: No Such User Here
Please note that username above represents the cPanel username.

The following commands should do this for you (please note that I'm having a backup created of /etc/valiases before the command to ensure that you have a method to covert back to the previously working files):

Code:
cp -R /etc/valiases /etc/valiases.bak110510
for i in `ls /var/cpanel/users/`;do replace "*: $i" "*: :fail: No Such User Here" -- /etc/valiases/*;done
This basically takes all instances of *: username and replaces them with *: :fail: No Such User Here instead. 

Next, anyone who has set their default email catchall to something else such as an email account will not be changed. The users who have done this likely do want to receive those emails.