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.

email filtering

Discussion in 'E-mail Discussions' started by lee., Sep 18, 2004.

  1. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    hello everyone,

    I host my domain using cpanel 9. The email filtering seems quite limited; I know I have access to filter options in Horde and squirrelmail but I always get my mail via pop to my mail client so need to rely on the powers of cpanel's filters in some ways;

    my current conundrum is:
    I need to filter mail sent to a certain email address on my domain in such a way that some of it (with a specific subject line content) goes to the inbox for that account whilst the rest of the mail gets discarded or maybe sent somewhere else. But this seems impossible to set up, partly because the filter options are quite basic and I seem to have no control over the ordering of the filters.

    is there a way to achieve my aim? Do I need to manually download and edit the filters.gz file with some way or technique then re-upload it? i'm already familiar with a similar technique for setting my alias file for various programs and mail lists.

    Or do I need to find and install some extra mail management software of some kind in my hosting? (or ask my host to?)

    thanks a lot for any help - I'm all out of ideas here,

    lee
    england
     
  2. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    hello everyone,

    (second and last posting of this in case anyone who can help missed the first one)

    I host my domain using cpanel 9. The email filtering seems quite limited; I know I have access to filter options in Horde and squirrelmail but I always get my mail via pop to my mail client so need to rely on the powers of cpanel's filters in some ways;

    my current conundrum is:
    I need to filter mail sent to a certain email address on my domain in such a way that some of it (with a specific subject line content) goes to the inbox for that account whilst the rest of the mail gets discarded or maybe sent somewhere else. But this seems impossible to set up, partly because the filter options are quite basic and I seem to have no control over the ordering of the filters.

    is there a way to achieve my aim? Do I need to manually download and edit the filters.gz file with some way or technique then re-upload it? i'm already familiar with a similar technique for setting my alias file for various programs and mail lists.

    Or do I need to find and install some extra mail management software of some kind in my hosting? (or ask my host to?)

    thanks a lot for any help - I'm all out of ideas here,

    lee
    england
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
  4. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    thanks for that,

    i'm just a web hosting client on someone else's server. I could ask the host guy for help but I think he may (reasonably) be unwilling to start taking custom filter requests.

    Is there no other way I can get more flexibility out of the cpanel options? I'm guessing not. Shame that the filter options are quite basic.

    lee
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    It is unfortunate, but it's tricky to get a great deal of functionality out of a web-based interface for something that is essentially a mini programming language. I guess your best bet would be to see if your hosting provider would help you more by looking into the filters for you.
     
  6. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Thanks again,

    The server's OS is FreeBSD so maybe I can find a compatible email client I can install in my webspace to act on mails, before I then pop from that to my pc. I'm on good terms with my hosting guy but he's so busy doing paid work (he's also a programmer) that I know he won't be able to help me at the drop of a hat. In the past, I tentatively looked into Mutt but wasn't sure if it was compatible or had any idea how to install it in my webspace anyway.

    Do you or anyone else know of a relevant piece of software which would work with my cpanel email accounts? All I really need it to do is pop from my domain's accounts with filtering including delete/discard options. I would then like to pop from the resulting inbox to my pc's Thunderbird. The main drive behind all this is to stop most spam and virus emails from getting through my domain in the first place. I would achieve this by applying specific filters to specific accounts, where there is guaranteed and unique sender/subject/body content.

    I think I'm kind of looking for an executable version of Horde, or something ...

    Many thanks,
    lee
     
    #6 lee., Sep 21, 2004
    Last edited: Sep 21, 2004
  7. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    further afterthoughts:

    I have access to and currently use aliases, cron jobs and wget;
    maybe these could be useful in conjunction with my last mail?

    lee
     
  8. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    hello again,

    Does anyone know how / if / in which order i can add one or more cpanel email filters to achieve _all_ the following:

    email from a specific person to a specific address to go there directly;
    all other email to the same address to be piped to a unique file destination;
    email from the same person above to a second specific address to go there directly;
    all other email to the second address to be piped to a second unique file destination.

    If I don't hear from anyone, I'll assume you don't think it's possible.

    Thanks a lot,
    Lee
     
  9. picoyak

    picoyak Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    6
    I dunno, but I just can't help but think this would be possible using Exim filter rules?

    Now this is just me throwing out an initial idea, but possibly a .forward file constructed like...

    Code:
    # Exim filter
    if $header_from: contains "foo@bar.com" and
       $header_to: contains "user1@yourdomain.com" then
       deliver user2@yourdomain.com
    This could handle the multiple cases you're speaking of. Haven't tested yet. Maybe when the dentist is done working me over today I will though :eek:

    Those more familiar with Exim... is this a possible solution?
     
    #9 picoyak, Oct 8, 2004
    Last edited: Oct 8, 2004
  10. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    hello,

    thanks; jonathan recently advised me to try and get my host to adjust the exim filters for me but he seems to be unwilling to do so.

    is a .forward file part of exim or is it something separate I could upload somewhere in my hosting? I also have access to my forwarders and aliases if that's any use or relevant here.

    By the way, good luck with the dentist - i went for a check yesterday because I knew something was wrong and it turns out I need a filling. Have to wait a couple of weeks for the proper filling but a temporary one's been put in with no pain involved at all in doing that.

    lee
     
  11. picoyak

    picoyak Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    6
    Well according to the exim docs, it's just a normal .forward file in your home directory. So assuming you have shell access then you could create or edit that.

    I did just test, and no dice. I must be missing a piece of the puzzle someplace. Maybe a Sieve filter would be more appropriate. This must be possible somehow. If so, I'm gonna find out. The mail server isn't allowed to win!

    Now... where's my toothbrush? :p
     
  12. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    hello again,

    Thanks for looking into it for me; I really wouldn't have much idea where to start myself.

    By the way, I don't have shell access unless I ask for it; in which case it's always easier if I get my host to do whatever the issue is.

    lee
     
  13. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Just in case it helps, I'll explain why I want to do this;
    I want to use the perl demime program on my mailing lists which I host, but posts from webtv subscribers (aghhh) throw a spanner in the works. This is because I need to set the relevant demime option to allow webtv's reply 'attachments', but this then produces an ugly section of full headers inline in the mail.

    So, after much (and continuing) fiddling about, the only practical solution (?) seems to be to somehow force webtv posts to go directly to the mail list alias so that demime doesn't act on them at all, whilst all the other subscribers' posts should be piped to demime then onto the mailing list.

    It may be an extra complication here that I want to demime 2 or more different lists, and the webtv subscribers need to be able to write directly into any of them. ie each list of course has its own mail-to address and relevant mail list alias.

    So to summarise, I need this:

    All mails sent to all (but finite amount of) mail lists should be piped via demime to the appropriate list, except for any mails from webtv subscribers which should go directly to the appropriate list.

    My mailing manager is Mailgust and the style of my aliases are as follows, where the incoming mail triggers a mailgust perl file to activate the cron and mail retrieval:

    list@domain.com: "|/home/mycpanellogin/www/mailgust/dbcron.pl 9" (for eg)

    I can work the demime pipe successfully by having the alias as: (all one line)

    list@mydomain.com: |/home/mycpanellogin/www/demime.pl '|/home/mycpanellogin/www/mailgust/dbcron.pl 9'


    I hope all that hasn't thrown everything into confusion now ...

    lee
     
  14. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Just in case anyone's interested, I spoke to my host and did some exim learning, and have succeeded in my aim by creating and uploading a filter as shown below. It's my first attempt at an exim filter so I appreciate it may be excessively long.


    # Exim filter
    if
    $header_from: contains "webtv" and
    $header_to: contains "list@mydomain.com"
    then
    pipe "/home/mycpanellogin/www/mailgust/dbcron.pl 1"
    endif
    if
    $header_from: does not contain "webtv" and
    $header_to: contains "list@mydomain.com"
    then
    pipe "/home/mycpanellogin/www/demime.pl '|/home/mycpanellogin/www/mailgust/dbcron.pl 1'"
    endif

    ... then the same section again but specific to my other mail list address.

    lee
     
  15. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Excellent stuff. Well done for cracking it :)
     
  16. picoyak

    picoyak Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    6
    Aaah, yeah... I forgot ENDIF :p

    Nice job there lee!
     
  17. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    thankyou to you both;

    I can see that using
    else
    probably can shorten and simplify things, but it works, so .....! ....

    lee
     
  18. taotoon

    taotoon Well-Known Member

    Joined:
    Nov 14, 2004
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    Where to put your souce code ?

    it is .forward ?


    thankz
     
  19. lee.

    lee. Member

    Joined:
    Sep 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    I downloaded the relevant backup file for the domain, unzipped it, then opened the file in Notepad on my pc.

    I then changed the file, saved it, rezipped it with the same name, and uploaded it using cpanel's restore alias/filter option.
     
  20. bagel50

    bagel50 Member

    Joined:
    Jun 1, 2005
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I'm writing .forward files in my home directory, but they just seem to be completely ignored.
    The .filter file does not follow the exim mailfilter rules as if it were a .forward file. I need more than the simple filtering allowed in CPanel and exim filters seem the less problematic way of achieving that (versus procmail), since they *should* be automatically run. They're not at the moment, how is that situation changed, does anyone know?


    Many thanks for any who can help...


    Olly.
     
Loading...

Share This Page