Web Hosting Forums

Results 1 to 9 of 9

This is a discussion on Problems getting email filters to work in the Hosting Talk & Chit-chat forum
I'm guessing this may be related to the move to maildirs. But, I had a small handful of filters to sort mail into different folders ...

  1. #1
    Loyal Client
    Join Date
    Jul 2003
    Posts
    5

    Problems getting email filters to work

    I'm guessing this may be related to the move to maildirs.

    But, I had a small handful of filters to sort mail into different
    folders on the server. This appears to not be working. At
    a minimum any new filters I have tried to create have had
    no effect.

    The path I had used is:
    /home/account/mail/account.com/user/<folder>

    I have tried that plus

    /home/account/mail/account.com/user/.<folder>/cur (or new)

    to no effect. Email just seems to go nowhere. From reading other
    threads on here, I believe the above path was what was
    recommended, though I would have thought dumping it into the
    new directory would be better than the cur directory (but I'm
    no expert on maildirs).

    Alternatively, are there better ways to do this? Setting up filters
    in the mail client does not work for me as I will access it from
    a variety of locations (web mail, thunderbird on several machines)
    and would like to have the filtered view in each case.

    Am I also correct in believing that there is no mail log file
    to exam for mail related problems?

    Thanks
    John

  2. #2
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,661
    Quote Originally Posted by tillema View Post
    /home/<account>/mail/<account.com>/user/.<folder>/cur
    That path looks correct, to me. It's is same tree I use to manipulate mail...
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL 2010

  3. #3
    Loyal Client
    Join Date
    Jul 2003
    Posts
    5
    Any reason why you modify the cur directory and not the new?
    I would have expected any new mail messages to be dumped into new until
    they are read.

    Using the test filter method on the new control panel setup page, I get this:

    Condition is true: $header_subject: contains test
    Return-path copied from sender
    Sender = <account>@titanium.nocdirect.com
    Recipient = <account>@titanium.nocdirect.com
    Testing Exim filter file "/etc/vfilters/<account>.com"

    Save message to: /home/<account>/mail/<account>.com/<user>/.caic/cur/ 0660

    So this looks correct, sort of. The problem (I think) is that it is trying to save into
    a specific file name rather than a maildir format. I tested this by specifying a
    filename rather than a directory and sure enough a normal mailbox style file got
    created. Yet IMAP appears to be working via the maildirs, so there's a disconnect
    between the two. I'm guessing this is a file a support ticket thing to get fixed.

    Thanks
    John

  4. #4
    Loyal Client
    Join Date
    Nov 2004
    Posts
    34
    Quote Originally Posted by tillema View Post

    The path I had used is:
    /home/account/mail/account.com/user/<folder>

    I have tried that plus

    /home/account/mail/account.com/user/.<folder>/cur (or new)

    to no effect. Email just seems to go nowhere. From reading other
    threads on here, I believe the above path was what was
    recommended, though I would have thought dumping it into the
    new directory would be better than the cur directory (but I'm
    no expert on maildirs).
    It's been a while since this was posted, but since I've been attempting to do the same thing I thought I'd post what I've found.

    The solution was actually VERY simple. You'll need to use either the cur or new directory and be sure to add a final forward slash "/" after the directory that you're trying to copy the emails into. You don't have that in your directory paths listed above.

    From what I can tell it doesn't really matter which directory (cur or new) that you save the file to. However, if you forget that last slash, your emails will vanish into thin air. Once I added that slash, all test emails are getting copies where they belong with no problems.

    The only thing I don't know is what the "0660" is. Tillema shows it in his filter test results. If you download a the filter file from the backup section of the cPanel, you'll see that the 660 is added to the end of the "save" line there as well. I'm assuming that it's saving the email with permissions of 660, but I don't know this for sure.

    Good Luck!
    Last edited by byrd; 01-24-2007 at 01:58 PM.

  5. #5
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,661
    Aha! Makes sense! They were probably going to null.

    I didn't understand exactly what you were trying to do. My bad...

    Thank's for the update!
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL 2010

  6. #6
    Loyal Client
    Join Date
    Nov 2004
    Posts
    34
    Quote Originally Posted by byrd View Post
    The only thing I don't know is what the "0660" is. Tillema shows it in his filter test results. If you download a the filter file from the backup section of the cPanel, you'll see that the 660 is added to the end of the "save" line there as well. I'm assuming that it's saving the email with permissions of 660, but I don't know this for sure.
    Yup! The 660 is simply the file permissions that are being assigned to the email file that you're saving. It's simply a needed parameter for the Exim "save" command. This info isn't necessary if you're using the email filter page through cPanel, but if you're creating more complex custom filters using a the process described here: http://www.jaguarpc.com/forums/showthread.php?t=15217 then you will need to know the full save commend format.

    If anyone is interested, the exim.org website has a wealth of information in the documentation section for creating custom filters. I had a trouble ticket open yesterday for a related issue, and Masood explained that functions described at the exim.org website may or may not all work here at Jag. You've got to just test 'em out at see how things go. Either way, there appears to be some way cool stuff you can do with Exim filtering.

  7. #7
    Loyal Client
    Join Date
    Jul 2003
    Posts
    5
    Sorry, been out of town. Thanks for the replies.

    I had tried using the trailing '/' ( procmail required that change as well when we
    switched at work to using mail dirs).

    Yet, when I try it here using either cur/ or new/ I get the same behavior, the email
    disappears into that great bit bucket in the sky. If all I do is change the filter dir
    from ending in cur/ or new/ to a filename (say test), then I start seeing mail show up.
    I really expected to be able to cd (via the filemanager) to the mail directory listed
    by the filter and see new files getting created, but so far that has not occured.

    I may post a ticket request and see if I can have someone verify it's setup to work
    on my domain.

    But, just to be safe, here is the current filter I have:

    if
    $header_subject: contains "test"
    then
    save "/home/<account>/mail/<account>.com/tillema/.caic/cur/" 660
    endif

    Note that this was created using the control panel interface.

  8. #8
    Loyal Client
    Join Date
    Nov 2004
    Posts
    34
    Just out of curiosity, have you tried to create the filter in a text editor and uploading it through the Backup/Restore page of cPanel?

    I've noticed that when you create a filter in cPanel, those filters are stored in a file called ".filter" in your account root directory. When you create an exim filter that is restored through the Backup/Restore it gets saved someplace else (although I don't know where). Currently if I look at my filters page in cPanel it says "There are currently no active filters." But this is definitely NOT true. I'm currently using the following filter and it's working just fine. Testing with the cPanel Filter Test confirms this (as does actual email traffic).

    -------------------------------------
    # Exim filter

    if not first_delivery and error_message then finish endif

    if
    $h_X-Spam-Status contains "autolearn=spam"
    then
    save "/home/account/mail/domain.com/spam/.Trash/cur/" 660
    elif $h_X-Spam-Flag: is "YES"
    then
    save "/home/account/mail/domain.com/spam/.spam/cur/" 660
    finish
    endif
    -------------------------------------

    If I download a backup of the filters from the cPanel restore page I download the backup of the above filter just as expected. BUT, if I download the .filter file from my account root directory, it's an empty file. Creating a filter though cPanel will change the .filter file, but if you download it, you'll notice that it's not in Exim format. I have no idea what format it's in, or why there seems to be two different means by which filters are implemented on the accounts.

    It still seems odd that you can't get the filter working through the cPanell creation tool, but I'd try this anyway just to see if you have any better luck.

    If you try to upload the filter using the cPanel Backup/Restore page, be sure to follow the instructions that allobrogica spelled out in the link I posted in my first comment. If you're on a windows machine, you'll also need to download Win-GZ to create Gzip files. You can download that for free here: http://www.simtel.net/product.php?ur...uct_page=63053
    Last edited by byrd; 01-26-2007 at 09:24 AM.

  9. #9
    Loyal Client
    Join Date
    Nov 2004
    Posts
    34
    Just out of curiosity, have you tried to create the filter in a text editor and uploading it through the Backup/Restore page of cPanel?

    I've noticed that when you create a filter in cPanel, those filters are stored in a file called ".filter" in your account root directory. When you create an exim filter that is restored through the Backup/Restore it gets saved someplace else (although I don't know where). Currently if I look at my filters page in cPanel it says "There are currently no active filters." But this is definitely NOT true. I'm currently using the following filter and it's working just fine:

    -------------------------------------
    # Exim filter

    if not first_delivery and error_message then finish endif

    if
    $h_X-Spam-Status contains "autolearn=spam"
    then
    save "/home/account/mail/domain.com/spam/.Trash/cur/" 660
    elif $h_X-Spam-Flag: is "YES"
    then
    save "/home/account/mail/domain.com/spam/.spam/cur/" 660
    finish
    endif
    -------------------------------------

    If I download a backup of the filters from the cPanel restore page I download the backup of the above filter just as expected. BUT, if I download the .filter file from my account root directory, it's an empty file. Creating a filter though cPanel will change the .filter file, but if you download it, you'll notice that it's not in Exim format. I have no idea what format it's in, or why there seems to be two different means by which filters are implemented on the accounts.

    It still seems odd that you can't get the filter working through the cPanell creation tool, but I'd try this anyway just to see if you have any better luck.

    If you try to upload the filter using the cPanel Backup/Restore page, be sure to follow the instructions that allobrogica spelled out in the link I posted in my first comment. If you're on a windows machine, you'll also need to download Win-GZ to create Gzip files. You can download that for free here: http://www.simtel.net/product.php?ur...uct_page=63053

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •