You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LECKERBEEFde 88440f545b Update 4 years ago Update 4 years ago
fetchmail.ldif Update fetchmail.ldif 4 years ago
fetchmail.schema Update fetchmail.schema 4 years ago incorporate changes suggested by @LECKERBEEFde 4 years ago


OpenLDAP schema to dynamically generate a configuration file to poll mails via fetchmail .


  • fetchmailEnabled » TRUE or FALSE - used to deteced if the entry should be parsed or not
  • fetchmailServer » DNS-Name of the Mailserver (but also works with IP-Addresses)
  • fetchmailProtocol » e.g. pop3, imap or any other protocol supported by fetchmail
  • fetchmailUsername » Username of the mailbox you’re connecting to
  • fetchmailPassword » same as above
  • fetchmailCustom » add any additionial commands like nokeep fetchall
  • fetchmailSSL » TRUE or FALSE - set this to enable SSL support

Expected DIT

Basically you should have two Trees:

  • one with the global settings used for each individual user, like fetchmailServer, fetchmailProtocol and fetchmailCustom
  • another tree with the actual users (should be inetOrgPerson). These must have at least added fetchmail to ObjectClass and a valid mail attribute. Usually you also add the attributes fetchmailUsername and fetchmailPassword

So the tree looks like:

|_ ou=Templates 
|  |_ cn=fetchmailDefaults
|     |_ fetchmailEnabled = true
|     |_ fetchmailServer =
|     |_ fetchmailProtocol = pop3
|     |_ fetchmailCustom = nokeep fetchall
|     |_ fetchmailSSL = false
|     |_ sn = Fetchmail Default Values
|     |_ objectClass = top, inetOrgPerson, fetchmail
|_ ou=Users
   |_ uid=testuser
      |_ mail =
      |_ fetchmailEnabled = true
      |_ fetchmailUsername = testuser
      |_ fetchmailPassword = topSecret
      |_ fetchmailSSL = true <-- This would overwrite the Default-Settings

This will generate the following line that will be passed to fetchmail:

poll proto pop3 user testuser pass toSecret is here nokeep fetchall ssl

Add Schema

Method 1:

add this line to /etc/ldap/slapd.conf: include /etc/ldap/schema/fetchmail.schema

Method 2:

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/fetchmail.ldif

Edit Settings



that it fits your LDAP configuration.

Test it!

Run and take a look at the output - it should be similiar to the poll ... line.

If everything is fine setup a Cronjob to invoke the script:

*/5 * * * * /usr/local/bin/ | fetchmail -f -

Developers Homepage