2

everyone. I have installed Postfix on a server with Aliases and Domains from a MySQL Database.

It is configured to forward some adresses to other Mail Accounts and also delivers some mails in local mailboxes that will be queried over a dovecot imap server.

For this example let there be two users:

  • forwarded@domain.com what is a user that gets its mail just forwarded to let's say forwarded@forwarded-host.com
  • local@domain.com what is a user that accesses its mail from local IMAP.

Now, I want to fetch some Mails from another mailserver and handle them as if they were sent to a user of my Mailserver.

Lets say those corelations exist:

  • forwarded@domain.com has two external accounts: user-a@externaldomain.com and user-a@some-other-company.com
  • local@domain.com has also one external account user-b@externaldomain.com

The Problem is the new mails on that other Mailserver is not always in the inbox, it might be in subdirectories: mailinglists/all or mailinglists/it but also in mailinglists/some-other-department which is not interesting and should not be delivered.

I already found a programm called fetchmail but I cannot find how to fetch subdirectories or decide which subdirectories are fetched.

Tobi
  • 237
  • 3
  • 12

1 Answers1

5

You can use the folder option. Just put it in the fetchmail config file (Default is .fetchmailrc).

poll mail.server.com protocol IMAP
    user 'xxx@xxx,com'
    password 'xxxxxx'
    folder 'mailinglist'

See man page or search for "fetchmail folder option" if you need more examples.

jam
  • 88
  • 6
  • 1
    Will I repeat the "folder" part per folder, I want to sync or do I need to repeat the whole poll part? – Tobi Aug 18 '14 at 22:19
  • 1
    Have you had a look at the man page? (Keyword: folder[s]) Causes a specified non-default mail folder on the mailserver **(or comma-separated list of folders)** to be retrieved. The syntax of the folder name is server-dependent. This option is not available under POP3, ETRN, or ODMR. – jam Aug 19 '14 at 05:51