[solved]The correct transfer of fetchmail to Postfix WITHOUT kopano-dagent



  • Hello together,
    I have a somewhat special construction.
    Kopano server with Postfix [ with Ciphermail encryption ] with Fetchmail.

    Mail addresses for testing . info@mydomain.de; name@mydomain.de; name@otherdomain.de

    Kopano Server sends mails via Postfix to the outside. This works.
    I can successfully sign, encrypt or send mails as encrypted PDF to the outside world. But Ciphermail should not be the focus here, that is anyway only a pimped postfix.
    Fetchmail can also fetch my emails and if I enter as mta the Kopano-dagent in my fetchmailrc the mails will be delivered correctly to my Kopano users.

    But I don’t want to give my mails directly to the dagent, because otherwise they won’t be decrypted correctly, that must be the Postfix ( Ciphermail ) again.

    So I have to pick up my mails with Fetchmail and send Postfix to Kopano for delivery.
    And that’s exactly my problem and I’ve tried so many things and so many snapshots in virtual machines that I’ve completely lost track of it.

    I think one problem is that there are no local users with a mailbox, but only those that are stored in the mysql kopano database.

    There are exactly two things here that I don’t know exactly ( probably much more, but two I’m aware of :=)

    What is in my case the exact syntax for passing to the local postfix?
    How is the postfix able to recognize if the mail should be sent to Kopano or if it should be sent to the remote mailbox?

    So Postfix must be responsible for the internal as well as for the external mailboxes, which in my case are the same as well.

    I don’t want to use a ’ Kopano-Fetchmail-Plugin’ solution and even with Ciphermail I can’t use the integrated Fetchmail solution because we don’t use the appliance.

    Somebody must have had a similar problem, right?
    Kopano sends via Postfix to external, fetchmail retrieves mails and delivers them to Postfix, it delivers again to Kopano.

    Some infos:

    ## Allgemeine Einstellungen
    
    set daemon 60                 # E-Mails alle 1 Minuten abholen, in Sekunden
    set syslog                    # In Syslog loggen
    set postmaster "root"         # Postmaster festlegen
    set no bouncemail             # Leite Fehlermails zum Postmaster um
    
    ## Konten
    
    # Works while Mails are send directly to kopano-dagent
    #poll sslin.df.eu with proto IMAP user "name1@domain.com" there with password "password1" mda "/usr/sbin/kopano-dagent username1" options keep ssl
    #poll imap.gmail.com with proto IMAP user "name2" there with password "password2" mda "/usr/sbin/kopano-dagent username2" options keep ssl
    
    
    # Tests
    poll imap.gmail.com with proto IMAP user "name1@domain.com" there with password "password1" options keep ssl
    poll sslin.df.eu with proto IMAP user "name1@domain.com" there with password "password2" options keep ssl
    

    Assignment of users

    # forward local system accounts
    
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-users.cf
    virtual_alias_maps = hash:/etc/postfix/virtual
    virtual_mailbox_domains =
    virtual_transport = lmtp:[localhost]:2003
    
    #virtual_alias_maps = hash:/etc/postfix/virtual
    #virtual_mailbox_maps = hash:/etc/postfix/virtual
    #virtual_mailbox_maps = mysql:/etc/postfix/kopano-users.cf
    

    /etc/postfix/virtual

    
    #Emailaddress or alias  primary mailaddress of user
    name1 ( kopano username ) name1@mydomain.com
    name2 ( kopano username ) name2@mydomain.com
    
    
    
    user = kopano
    password = kopano
    hosts = 127.0.0.1
    dbname = kopano
    #query = SELECT value FROM objectproperty where propname = ‚emailaddress‘ and value = ‚%s‘;
    query = SELECT value FROM objectproperty where propname = 'emailaddress' and value = '%s';``````
    Insert Code Here
    

    I can provide you with more information.

    Does anyone have an idea how I could proceed or check?


  • Kopano

    WITHOUT kopano-dagent

    you always have to deliver your emails via the dagent. What you are looking for is delivering the mails from fetchmail to postfix and let postfix deliver to kopano.

    This process is explained at https://documentation.kopano.io/kopanocore_administrator_manual/configure_kc_components.html#kc-postfix-integration



  • Thank you very much for your answer, but
    damn…i was hoping i wouldn’t get that answer. i’ve worked my way through this configuration and just couldn’t get it done. One error results in the next error.
    I will simply try it again.
    Thanks first for your trouble



  • So I just rebuilt the part according to the instructions.
    Now it’s like this:

    I send a mail to name1@mydomain.com.
    Fetchmail fetches the mailbox, sees there is an unread mail, apparently successfully forwards it to Postfix,
    this one recognizes, aha,. for mydomain i am responsible, so i send this mail to the smarthost and not to my internal Kopano user.
    It also seems logical to me how Postftix should know if the mail is responsible for the internal user name1@mydomain or for the external mailbox name1@mydomain.
    Thank God, it seems to be read after the first run, otherwise I would have a loop here.

    Do I have to tell postfix via fetchmail that this is only for internal distribution? That would seem logical to me…


  • Kopano

    You are missing the is taumeister here bit in your fetchmail configuration



  • Hi Felix,
    thanks for your help.
    So, mails can now be sent via ciphermail ( postfix ) and fetchmail also passes correctly to Postfix.
    So both directions work.
    Thanks for this.

    Of course, for each new solution at least one new or further problem is added :)

    Now I get the mails from fetchmail to Postfix to Kopano, but apparently they are not decrypted by Postfix (Ciphermail).
    So I can’t read mails that are signed and encrypted.
    Public keys are of course available on both sides.

    You don’t happen to know anything about Ciphermail and could help out?
    Greetings


  • Kopano

    No, I cannot help out with that. But make sure to post the answer here as well if someone else runs into this.



  • ok.

    Felix, thanks for your help.



  • hmm how do i do this? …mark as solved



  • @taumeister I have asked the same question in the past. You need to edit your first posting



  • thanks tjoen.



  • poohh how complicated a simple thing can be.
    Why is there no ‘solved’ button?