Hey there. I apologize if this has already been answered but I couldn't find it. Does anyone know how to disable default email addresses for all accounts on WHM 11.30.0.?
Hey there. I apologize if this has already been answered but I couldn't find it. Does anyone know how to disable default email addresses for all accounts on WHM 11.30.0.?
The default email address will always exist on cPanel at this time, but you can change the behavior for the default address to not have emails go to it directly on account creation. This would be done in WHM > Tweak Settings > Initial default/catch-all forwarder destination area. You could change it to "Fail" rather than the "System account default" selection, then click the "Save" button there.
I also did a post recently on how to change the accounts that previously had it set to the default at this location:
http://forums.cpanel.net/f43/root-em...tml#post857372
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Forums Technical Analyst, cPanel Tech Support
Submit a ticket | Check an existing ticket
Thanks. Is there a way to hide this Default Address from the cPanel under Email accounts?
There is not a way to hide this address, but you are welcome to lend support to the existing feature request to have this default cPanel username address removed:
http://forums.cpanel.net/f145/case-4...in-134421.html
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Forums Technical Analyst, cPanel Tech Support
Submit a ticket | Check an existing ticket
I agree that the default email address based on the account name is a problem for all the reason stated above. I support the move to change this behaviour of cPanel.
My previous reply:
Have you posted on the feature request thread that I indicated? I do not see a post there on any of the 3 pages of the request. I would be very happy to move your post to that thread if you would like.There is not a way to hide this address, but you are welcome to lend support to the existing feature request to have this default cPanel username address removed:
http://forums.cpanel.net/f43/f145/ca...in-134421.html
Of note, in the meantime, I am working on how to disable the address from showing up and working. Once I have the script completed on how to get it disabled, I will post it here as a guide; however, posting in this thread will not lend support to the feature request itself, so you would need to post your support there for that functionality.
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Forums Technical Analyst, cPanel Tech Support
Submit a ticket | Check an existing ticket
I have the steps you can use to disable the default address working and showing up in cPanel until such a feature has been implemented.
First of all, do the following in WHM > Packages > Feature Manager, select the disabled list there (if it does not exist, in root SSH go to /var/cpanel/features and create the file disabled).
In that disabled feature list, select Default Address Manager and uncheck it, then click "Save"
The Default Address option will no longer appear in cPanel on accounts. Additionally, the default email address will not show up in cPanel > Email Accounts area.
Next, go to WHM > Tweak Settings > Initial default/catch-all forwarder destination, then change that from "System account default" to "fail" and click the "Save" button at the bottom. This will ensure all new accounts have no default address set for non-existing email address, so those addresses will fail.
Now, to replace any users who previously had it set to their cPanel username default address, do the following:
This will replace their username in those files with *: :fail: No Such User Here instead.Code:cp -R /etc/valiases /etc/valiases.bak110630 for i in `ls /var/cpanel/users/`;do replace "*: $i" "*: :fail: No Such User Here" -- /etc/valiases/*;done
Next, create the following file to disable username@hostname working:
The following content would be put into that file and should only be run once when first setting this up:Code:touch /etc/discarddefaultfilter chmod +x /etc/discarddefaultfilter
You would then run the script:Code:#!/bin/sh #Send username@hostname emails to /dev/null filter script #This writes to /etc/vfilters/ files for each main domain #This also creates /home/username/.cpanel/filter.yaml files for each account export HOSTNAME=`hostname` while read x ; do xUSER=`echo $x | cut -d : -f 2 | awk '{print $1}'` xDOMAIN=`echo $x | cut -d : -f 1` echo >> /etc/vfilters/$xDOMAIN echo 'if not first_delivery and error_message then finish endif' >> /etc/vfilters/$xDOMAIN echo 'if' >> /etc/vfilters/$xDOMAIN echo "\$header_to: is \"$xUSER@$HOSTNAME\"" >> /etc/vfilters/$xDOMAIN echo 'then' >> /etc/vfilters/$xDOMAIN echo 'save "/dev/null" 660' >> /etc/vfilters/$xDOMAIN echo 'endif' >> /etc/vfilters/$xDOMAIN done < /etc/trueuserdomains for i in `ls /var/cpanel/users/`; do echo "--- filter: - actions: - action: save dest: /dev/null filtername: default discard rules: - match: is opt: or part: \"$(printf '$header_to:')\" val: $i@$HOSTNAME unescaped: 1" >> /home/$i/.cpanel/filter.yaml; done for i in `ls /var/cpanel/users/`; do chown $i:$i /home/$i/.cpanel/filter.yaml; done
Thanks go to Jeff P at cPanel for the first portion of the script.Code:/etc/defaultfilterscript
I will need to check further into how this can be accomplished on new account creation so that you have a postwwwacct script to add these entries for a new account that is created.
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Forums Technical Analyst, cPanel Tech Support
Submit a ticket | Check an existing ticket
OK.. fixed the fail: it needed to be saved as unix end of line charachters
After running this script I am getting a lot of mail stuck in the queue. When I try to run the queue I get the error:
How can I fix this?Code:R=central_filter defer (-17): error in redirect file: missing or malformed local part (expected word or "<") in "if not first_delivery and error_message then finish endif"
I got the following:
/etc/discarddefaultfilter: line 5: account: command not found
/etc/discarddefaultfilter: line 13: syntax error near unexpected token `newline'
/etc/discarddefaultfilter: line 13: ` echo 'if not first_delivery and error_message then finish endif' >> '
WHM 11.32.2 (build 15)