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.

How to block e-mail that contains a field of annexes by domain

Discussion in 'E-mail Discussions' started by suporteidc, Sep 23, 2008.

  1. suporteidc

    suporteidc Registered

    Joined:
    Sep 23, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I would like to know if there is any possibility of blocking mail that contains annexes on the server by domain, for example:

    domain1.com.br = blocking annexes ". mp3, .exe, .mpg, .mpeg, .jpg, .gif".


    It is possible? How to make this process?

    Thanks,
     
  2. d_t

    d_t Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    243
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Bucharest
    you mean attachments? try something like this in exim filter file (usually, /etc/cpanel_exim_system_filter )

    Code:
    if $header_from: contains "@domain1.com.br" and $header_content-type: matches "(?:file)?name=(\"[^\"]+\\\\.(?:mp3|exe|mpg|mpeg|jpg|gif)\")"
    then
      fail text "This message has been rejected because it contains a blocked attachment."
      seen finish
    endif
    
     
  3. suporteidc

    suporteidc Registered

    Joined:
    Sep 23, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello d_t.

    Thanks for your help.

    But not satisfied this command, not blocked anything.

    Have some more Suggest?
     
  4. lngtanseco

    lngtanseco Well-Known Member

    Joined:
    Jun 9, 2006
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    Check if you are modifying the correct file.

    Normally it's something like below:

    WHM > Exim Configuration Editor > ** System Filter File [?] > /etc/cpanel_exim_system_filter


    Then try this code.

    Code:
    if      (
             $header_from contains "domain1.com.br"
            ) and (
             $header_content-type: matches "(?:file)?name=(\"[^\"]+\\\\.(?:mp3|exe|mpg|mpeg|jpg|gif)\")"
    )  then
       fail text "This message has been rejected because it contains a blocked attachment."
      seen finish
      endif

    If that doesn't work, you may want to post the content of /etc/cpanel_exim_system_filter for review.
     
  5. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    Another way of doing this, if you can't get cPanel filters to work, is MailScanner. You can get MailScanner via www.configserver.com and there is a FAQ entry there describing similar stuff to what you are trying. It does require server root access to install though, and a little time; although they (configserver) will do it for you and are very trustworthy and good at what they do.
     
Loading...

Share This Page