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.

Create Default IMAP folder?

Discussion in 'E-mail Discussions' started by MACscr, Oct 13, 2013.

  1. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I am scanning email for spam before it hits my cpanel servers, email found to be spam is tagged in the header with: X-Spam-Flag: YES. I would like to create a folder in all email accounts called Junk. And then make sure all email with that header value get delivered automatically into that folder. Would be even better to figure out a cron job to empty it every 30 days or so. I know SA already does something like this, but I am not going to be running SA on my cpanel servers. Any suggestions are appreciated. I 100% understand this isnt the norm and is something were going to code up. Note, I am using dovecot on my servers.
     
    #1 MACscr, Oct 13, 2013
    Last edited: Oct 13, 2013
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can utilize the "Account Level Filtering" option that is available in cPanel. It's documented at:

    Account Level Filtering

    One of the available actions is "Deliver to Folder".

    Thank you.
     
  3. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Michael,

    Thanks for the response, but I am looking to create this in an automated fashion for all existing accounts and then of course make it default for new accounts that are created. I think I made that pretty clear. Doing it manually through the gui for each account just isnt going to work for a thousand email accounts.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can develop a custom bash script that will create those email folders and add filter rules for all existing accounts. Or, you could outsource that type of project to a developer. You can find a list of third-party developers in our application catalog:

    Application Catalog - Development Services

    Thank you.
     
  5. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Michael,

    I am a developer and I have figured out how to automate the filter creation, but the default imap folder issue is a dovecot configuration question. The dovecot autocreate plugin does work this purpose, but its also been depreciated in 2.2 and while still working, throws warnings about it being depreciated and that we should use mail {auto}. Which i have no idea how to use with cpanel's implementation of dovecot 2.2. Here are the docs for creating default imap folders: MailboxSettings - Dovecot Wiki
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can edit the following file for local modifications to the Dovecot configuration:

    Code:
    /var/cpanel/templates/dovecot2.2/main.local
    Note: You can copy this file from /var/cpanel/templates/dovecot2.2/main.default if it does not exist. After making the custom modifications, you must run:

    Code:
    /scripts/builddovecotconf
    Let us know if this method is not allowing you to make custom changes.

    Thank you.
     
  7. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Right, I have already made a custom main.local, but I am not sure what the layout should be for this particular setting when it relates to how the main.local is setup for cpanel. The example from the dovecot wiki shows:

    Code:
    namespace inbox {
      #prefix = INBOX. # the namespace prefix isn't added again to the mailbox names.
      # ...
    
      mailbox Trash {
        auto = no
        special_use = \Trash
      }
      mailbox Drafts {
        auto = no
        special_use = \Drafts
      }
      mailbox Sent {
        auto = subscribe # autocreate, autosubscribe
        special_use = \Sent
      }
      mailbox Spam {
        auto = create # autocreate, but don't autosubscribe
        special_use = \Junk
      }
      mailbox virtual/All { # if you have a virtual "All messages" mailbox 
        auto = no
        special_use = \All
      }
    }
    But in my case, the Junk folder should not be a child of the Inbox and it appears that cpanel things a bit differently. I am definitely open to suggestions. Thanks again for the help.
     
  8. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I was overcomplicating things. I just needed to add the following in namespace { } before the last bracket:

    Code:
      mailbox Junk {
        auto = subscribe # autocreate, autosubscribe
        special_use = \Junk
      }
     
  9. FeeReD

    FeeReD Well-Known Member

    Joined:
    Dec 1, 2005
    Messages:
    63
    Likes Received:
    0
    Trophy Points:
    6
    Dovecot folder structure in cPanel

    People at my work are use to using a default folder structure for their IMAP clients. We are moving away from a really expensive to the simple mail cPanel alternative.

    I am hoping though that someone knows a way to change the namespace from the following:

    Code:
    Inbox
     --- Drafts
     --- Junk
     --- Sent
     --- Trash
    
    to

    Code:
    Inbox
    Drafts
    Sent Items
    Deleted Items
    Junk Email
    
    I'm not sure if what was posted will override any settings of the default config cPanel has set. Will this cause anything to go haywire? Also, do I create a separate namespace for each folder? And if I follow those instructions on that page, how do I assign the trash folder?

    Cheers
     
    #9 FeeReD, Feb 5, 2014
    Last edited: Feb 5, 2014
  10. FeeReD

    FeeReD Well-Known Member

    Joined:
    Dec 1, 2005
    Messages:
    63
    Likes Received:
    0
    Trophy Points:
    6
    Would switching to courier in cPanel fix this?
     
Loading...

Share This Page