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.

Block Email With Certain Subject

Discussion in 'E-mail Discussions' started by Sash, Aug 12, 2003.

  1. Sash

    Sash Well-Known Member

    Joined:
    Feb 18, 2003
    Messages:
    252
    Likes Received:
    0
    Trophy Points:
    16
    Does anyone know how to get Exim to block ALL email coming into the server with a certain subject?

    Thanks
    MIke

    cPanel.net Support Ticket Number:
     
  2. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    When you say server, do you mean for a specific domain or for all domains on the server?

    cPanel.net Support Ticket Number:
     
  3. Sash

    Sash Well-Known Member

    Joined:
    Feb 18, 2003
    Messages:
    252
    Likes Received:
    0
    Trophy Points:
    16
    Hi

    ALL domains on the server.

    Thanks
    MIke

    cPanel.net Support Ticket Number:
     
  4. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    edit /etc/antivirus.exim
    scroll all the way to the bottom
    add:
    Code:
    if
      $header_subject: contains "SUBJECT-LINE" or
     then
      save /dev/null
    endif
    Save, close & restart exim.

    cPanel.net Support Ticket Number:
     
  5. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    mmm we don't want to have to write transports just to pipe mail into /dev/null. If you want to, use the above. If not, use the following:
    Code:
    if      
      $header_subject: contains "SUBJECT-LINE"
    then
      fail text "Your mail is not welcome."
     seen finish
    endif
     
    #5 ciphervendor, Aug 12, 2003
    Last edited: Aug 12, 2003
  6. Sash

    Sash Well-Known Member

    Joined:
    Feb 18, 2003
    Messages:
    252
    Likes Received:
    0
    Trophy Points:
    16
    I get this error inside the /var/log/exim_mainlog:

    2003-08-12 18:06:11 19md7Y-0003N5-2T Error in system filter: unrecognized condition word "or" near line 135 of filter file
    2003-08-12 18:06:11 19md2R-0002wr-0s Error in system filter: unrecognized condition word "or" near line 135 of filter file
    2003-08-12 18:06:11 19md2j-000330-5D Error in system filter: unrecognized condition word "or" near line 135 of filter file
    2003-08-12 18:06:11 19md2h-00032U-1P Error in system filter: unrecognized condition word "or" near line 135 of filter file
    2003-08-12 18:06:11 19md2l-00033e-4C Error in system filter: unrecognized condition word "or" near line 135 of filter file

    We want the filter to delete email based on mutliple subjects which why we are trying to use "or".

    Thanks
    Mike

    cPanel.net Support Ticket Number:
     
  7. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    shit...remove the "or" from the end of this line: $header_subject: contains "SUBJECT-LINE" or

    One set of rules at a time. Can't do multiple.
     
  8. Sash

    Sash Well-Known Member

    Joined:
    Feb 18, 2003
    Messages:
    252
    Likes Received:
    0
    Trophy Points:
    16
    But we are trying to filter multiple subjects. Example:

    $header_subject: contains "SUBJECT-LINE" or "subject-line" or "SUBJECT LINE"

    Thank
    Mike

    cPanel.net Support Ticket Number:
     
  9. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    You can't. You need to do one at a time:
    Code:
    if      
      $header_subject: contains "SUBJECT-LINE-ONE"
    then
      fail text "Your mail is not welcome."
     seen finish
    endif
    
    if      
      $header_subject: contains "SUBJECT-LINE-TWO"
    then
      fail text "Your mail is not welcome."
     seen finish
    endif
    
    if      
      $header_subject: contains "SUBJECT-LINE-THREE"
    then
      fail text "Your mail is not welcome."
     seen finish
    endif
    cPanel.net Support Ticket Number:
     
  10. Sash

    Sash Well-Known Member

    Joined:
    Feb 18, 2003
    Messages:
    252
    Likes Received:
    0
    Trophy Points:
    16
    Ouch....thanks


    Thanks
    Mike

    cPanel.net Support Ticket Number:
     
  11. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    You can always do a little string expansion if it helps:
    Code:
    if      
      $header_subject: matches "[S|s][U|u][B|b][J|j][E|e][C|c][T|t]"
    then
      fail text "Your mail is not welcome."
     seen finish
    endif
    
    cPanel.net Support Ticket Number:
     
  12. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    I can't think of a subject line that I would want to filter out for every single domain ... Can you give one example?
     
    #12 goodmove, Aug 12, 2003
    Last edited: Sep 23, 2003
  13. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Re: Re: Block Email With Certain Subject

    "Keep your nose out of other peoples business."

    cPanel.net Support Ticket Number:
     
  14. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    Or how about: "Keep your mouth shut when your opinion is not requested!"
     
  15. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Re: Re: Block Email With Certain Subject

    Impossible, you would have to escape the exclamation point--because we all (well almost all of us) know it's a reserved symbol. Try again son.

    cPanel.net Support Ticket Number:
     
  16. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    So humorous my boy...! Would you kindly accept a soother to keep both your mouth and your hostile covert opinions to your own self?

    Or alternatively, you are gracefully invited to continue pouring your venom by means of a PM....
     
  17. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    For the message of unwanted eMail:

    Begone

    Simple, effective, and works so well, in such a variety of situations. ;)

    cPanel.net Support Ticket Number:
     
  18. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
    Now the spammer more creative. I use email blocker for subject in this thread but recently i have email with these variant subject :

    - (no subject)
    - approve
    - your account
    - etc ....

    But the body of email all the same matter : How to enlarge YOUR THING :D

    So how to block email with Bad Word on body of email ?

    cPanel.net Support Ticket Number:
     
  19. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    :D I agree!

    I have just noticed your post... sorry for the delayed reaction. ;)
     
  20. taivu

    taivu Well-Known Member

    Joined:
    Nov 22, 2001
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Why? I have had no problems running something like this (lot s of rows snipped):

    Code:
    # Spamtrap
    if
     $message_headers contains "spamdomain.com"
     or $header_subject: contains "VALUABLE ITEMS FOR YOUR REVIEW"
     or $header_subject: contains "FREE PAY PER VIEW"
     or $header_subject: contains "FREE ADULT MOVIES"
     or $header_subject: contains "Off V1agra"
     or $header_subject: contains "Partnership Required!"
     or $message_headers contains "The Great American Online Drugstore"
     or $message_headers contains "goldmonkeys.biz"
     or $message_headers contains "kellysoffers.com"
     or $message_headers contains "bestspecials.biz"
     or $message_headers contains "greatbizservices.com"
     or $message_headers contains "salesjet.biz"
    then
     save /var/mail/spamtrap
     #or what ever action you want to take
    endif
    
    cPanel.net Support Ticket Number:
     
Loading...

Share This Page