Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    13

    Default Disable default Email address for all accounts?

    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.?

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Disable default Email address for all accounts?

    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

  3. #3
    Member
    Join Date
    Aug 2008
    Posts
    13

    Default Re: Disable default Email address for all accounts?

    Thanks. Is there a way to hide this Default Address from the cPanel under Email accounts?

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Disable default Email address for all 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

  5. #5
    Member
    Join Date
    Apr 2011
    Posts
    8

    Default Re: Disable default Email address for all accounts?

    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.

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Disable default Email address for all accounts?

    Quote Originally Posted by kitsguru View Post
    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:

    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
    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.

    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

  7. #7
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Disable default Email address for all accounts?

    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:

    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
    This will replace their username in those files with *: :fail: No Such User Here instead.

    Next, create the following file to disable username@hostname working:

    Code:
    touch /etc/discarddefaultfilter
    chmod +x /etc/discarddefaultfilter
    The following content would be put into that file and should only be run once when first setting this up:

    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
    You would then run the script:

    Code:
    /etc/defaultfilterscript
    Thanks go to Jeff P at cPanel for the first portion of the script.

    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

  8. #8
    Registered User
    Join Date
    Jul 2011
    Posts
    2

    Exclamation Re: Disable default Email address for all accounts?

    Quote Originally Posted by cPanelTristan View Post
    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:

    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
    This will replace their username in those files with *: :fail: No Such User Here instead.

    Next, create the following file to disable username@hostname working:

    Code:
    touch /etc/discarddefaultfilter
    chmod +x /etc/discarddefaultfilter
    The following content would be put into that file and should only be run once when first setting this up:

    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
    You would then run the script:

    Code:
    /etc/defaultfilterscript
    Thanks go to Jeff P at cPanel for the first portion of the script.

    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.

    2 Things:

    should the execute code read
    Code:
    /etc/discarddefaultfilter
    ??

    if so, it fails: bash: /etc/discarddefaultfilter: /bin/sh^M: bad interpreter: No such file or directory

  9. #9
    Registered User
    Join Date
    Jul 2011
    Posts
    2

    Default Re: Disable default Email address for all accounts?

    OK.. fixed the fail: it needed to be saved as unix end of line charachters

  10. #10
    Member
    Join Date
    Feb 2008
    Location
    Atlanta, GA
    Posts
    77
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default Re: Disable default Email address for all accounts?

    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:

    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"
    How can I fix this?

  11. #11
    JZM
    JZM is offline
    Member
    Join Date
    Aug 2007
    Posts
    10

    Default Re: Disable default Email address for all accounts?

    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)

Similar Threads & Tags
Similar threads

  1. default address :FAIL: prevents new email accounts
    By handsonhosting in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-19-2009, 05:36 PM
  2. enable/disable default address
    By crazyaboutlinux in forum New User Questions
    Replies: 10
    Last Post: 05-02-2009, 12:19 AM
  3. Change "Default email address" for all accounts
    By Bradl3y in forum E-mail Discussions
    Replies: 3
    Last Post: 07-20-2007, 08:45 AM
  4. Disable Default Address
    By adapter in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-18-2004, 05:28 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube