The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

howto disable mail for a domain

Discussion in 'E-mail Discussions' started by ephrondiana, Jul 22, 2008.

  1. ephrondiana

    ephrondiana Member

    Jun 15, 2007
    Likes Received:
    Trophy Points:
    I want to know, is it possible to disable mail functionality for a domain or account??
    One of the domain on the server got hacked and sending spam mails using php script.i don't need any mail send or receive by that domain.
    Please help ......
  2. viraj

    viraj Well-Known Member

    Sep 28, 2006
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider

    You can disable emails for a particular account from the server itself. Edit the /etc/localdomains file & remove the domain's entry from it. This file is queried every time a mail is either received or sent.

    Other ways is to add a catch-all to that domain, here's how to do it..

    1. Login to your cPanel.
    2. Go to Mail, then select Default Address.
    3. Click on the Set Default Address link.
    4. Enter a new valid email address to redirect all unrouted mail to in the text field next to web site domain name drop-down list. Select the correct root domain name if you have sub-domains.

    Alternatively, you can also set the default address as :blackhole: to throw away all incoming unrouted mail, or :fail: bounce message (replace bounce message with your own text, such as no such user here, or left blank) to bounce the unroutable email back to the sender.
    5. Click on the Change button, and your Main Account will no longer receive any email.

    There's another way of doing it too by setting up a filter :
    CPanel > Mail > E-mail Filtering > Add Filter > Select From that Contains @ with Destination "Discard".

    I'd recommend you instead of setting the catch-all to :fail, you should set it to :blackhole, so that spam doesn't even generate any bounce-back messages - it just disappears to no where :)

Share This Page