B
BJ4845

  • Jan 8, 2024
  • Joined Feb 18, 2022
  • 4 discussions
  • 9 posts
  • 1 best answer
  • Post posted... wait what? You got the answer!
  • Thank you for your ideas. Regardless of your understanding of why I’m using pmg, a solution would be nice. It is currently not possible to do it without pmg. I asked the mailow company for support some time ago but didn’t get any response. Perhaps the mail got lost in space 🙂. So self is the man.

    I found a way. This is not ideal yet, but it works for now and should survive an update. It could bring some problems if mailcow changes the handling of incoming mails from the clients. So it need to be verified before each update. In case anyone needs a similar solution, here’s what I did:

    In the folder “/opt/mailcow-dockerized/data/conf/postfix”

    cp anonymize_headers.pcre extra_modify_headers.pcre

    edit “extra_modify_headers.pcre” and add the following line at the bottom

    /^Subject: (.*)$/ FILTER smtp:PMGSERVER

    edit “extra.cf” and add the following line at the bottom

    smtp_header_checks = pcre:/opt/postfix/conf/extra_modify_headers.pcre

    restart docker postfix container and done.

    Also set sender dependent transport for every domain in mailcow GUI.

    What happens?

    Mailcow uses postfix to replace the headers of mails from the clients at port 465,587. Incoming mails on port 25 doesn’t need the replacement. The rules to edit the header are placed in the “anonymize_headers.pcre” file. The file will be overwritten by mailcow updates, so this must be copied. I added a rule to set a new filter for the mail. The filter is reachable through smtp as the line shows. I choose one header which should match every mail. Setting any header would increase postfix logs a lot because the filter would be set again and again for every matching header. After the mail passed the first queue the mail will be send to the filter in this case pmg. pmg can now do its work and then send the mail back to mailcow at port 25. Here the mail get processed normally like every other external mail. The “extra.cf” file is used by mailcow for custom modifications at the main.cf. So it survive updates.

    My frist idea was to edit the master.cf but this will not survive updates. At the moment mailcow only accept custom main.cf entries as I could see in the docs.

    If someone knows another solution, it would be nice if we exchange ideas.

    Best regards,

    BJ

    • Different third party antivirus scanner
    • Third Party ClamAV Databases
    • Third Party SpamAssassin Modules
    • Cluster-wide training
    • Tracking Center

    I use a lot of third party integrations and solutions from and for proxmox. Not every integration is available for rspamd or possible to integrate with mailcow easily. Every mail also internal mails, should be handled like possible bad mails. Also mails between different domains on the same server must be handled as external mails. At the moment it would be easier to send the mails trough pmg instead of changing to mailcow only.

  • PMG gives necessary features for me. At the moment it would be too much work to build the same features in mailcow if it would be possible. So it is easier to force all mails going trough the pmg if possible.

  • Hello,

    I use mailcow and proxmox mail gateway (pmg). Mails from and to external addresses will be send trough pmg well. I setup a transport map which I select at the domain settings. But I also want local mails should be checked by pmg. I tried to setup a transport map with destination *. Then all mails are sended to pmg and back to mailcow but then the mails stay in the queue and will not delivered to the mailbox. So is it possible to setup my idea?

    mailcow mailbox1 will send to mailcow mailbox2. So mailcow send the mail to pmg, there the mail will be checked and then pmg send the mail back to mailcow. Mailcow recognized the mail from the pmg and will put the mail directly to the mailbox.

    Best regards,

    BJ

    • Thank you for your ideas. Regardless of your understanding of why I’m using pmg, a solution would be nice. It is currently not possible to do it without pmg. I asked the mailow company for support some time ago but didn’t get any response. Perhaps the mail got lost in space 🙂. So self is the man.

      I found a way. This is not ideal yet, but it works for now and should survive an update. It could bring some problems if mailcow changes the handling of incoming mails from the clients. So it need to be verified before each update. In case anyone needs a similar solution, here’s what I did:

      In the folder “/opt/mailcow-dockerized/data/conf/postfix”

      cp anonymize_headers.pcre extra_modify_headers.pcre

      edit “extra_modify_headers.pcre” and add the following line at the bottom

      /^Subject: (.*)$/ FILTER smtp:PMGSERVER

      edit “extra.cf” and add the following line at the bottom

      smtp_header_checks = pcre:/opt/postfix/conf/extra_modify_headers.pcre

      restart docker postfix container and done.

      Also set sender dependent transport for every domain in mailcow GUI.

      What happens?

      Mailcow uses postfix to replace the headers of mails from the clients at port 465,587. Incoming mails on port 25 doesn’t need the replacement. The rules to edit the header are placed in the “anonymize_headers.pcre” file. The file will be overwritten by mailcow updates, so this must be copied. I added a rule to set a new filter for the mail. The filter is reachable through smtp as the line shows. I choose one header which should match every mail. Setting any header would increase postfix logs a lot because the filter would be set again and again for every matching header. After the mail passed the first queue the mail will be send to the filter in this case pmg. pmg can now do its work and then send the mail back to mailcow at port 25. Here the mail get processed normally like every other external mail. The “extra.cf” file is used by mailcow for custom modifications at the main.cf. So it survive updates.

      My frist idea was to edit the master.cf but this will not survive updates. At the moment mailcow only accept custom main.cf entries as I could see in the docs.

      If someone knows another solution, it would be nice if we exchange ideas.

      Best regards,

      BJ

    • BBJ4845

        Moolevel 1
      • Edited

      Hallo,

      gelegentlich zeigt Outlook eine Fehlermeldung. Das mailcow Postfach ist per EAS angebunden. In den Logs steht:

      nginx-mailcow_1 | XXX - XXX [05/May/2022:10:43:55 +0200] "POST /Microsoft-Server-ActiveSync?Cmd=FolderSync&User=XXX&DeviceId=XXX&DeviceType=WindowsOutlook15 HTTP/1.1" 403 0 "-" "Outlook/16.0 (16.0.4266.1001; MSI; x64)"

      sogo-mailcow_1 | May 5 10:43:56 86d46904f73a sogod [62]: XXX "POST /SOGo/Microsoft-Server-ActiveSync?Cmd=FolderSync&User=XXX&DeviceId=XXX&DeviceType=WindowsOutlook15 HTTP/1.0" 403 0/38 9.914 - - -472K - 11

      Ich kann den Fehler leider nicht reproduzieren. Er taucht mehrmals am Tag bei verschiedenen Postfächern auf.

    • I see that my mail client shows a new folder Shared where I can find the shared mailboxes.

      Another question: Is there an option to share the whole mailbox and not only folders? If I want to share a mailbox with 10 users I have to click every folder and share it. It would take some time.

    • Hi,

      is it possible to create shared mailboxes where defined users can also sync inbox, sent mails, etc. with imap?

      Best regards,

      Alex

    • As I described it seems to be the settings for disable spam filter at relay host settings. So I solved this by deleting this settings and add an rspamd-settings-map entry:

      priority = 10;
      rcpt = "/.*/";
      from = "/.*/";
      apply "default" {
      MAILCOW_WHITE = -9999.0;
      }
      symbols [
      "MAILCOW_WHITE"
      ]

      Is there an better way?

    • I setup BCC for one domain to send copies to a mail archive. Incoming mails where not send to the archive. Outgoing mails works.

      My setup:
      relayhost <-> mallow -> archive server
      Sender based transport map has a rule to send trough a mail relay for this domain
      Transport-Maps has a rule for the archive mail address and the archive server as next hop
      At BCC-Maps I added two entries. One with BCC-Typ sender and one receiver. Local target ist @MYDOMAIN and BCC-Target is the mail archive address.

      In postfix logs I see outgoing mails become the BCC address and where send to the mail archive server. For incoming mails nothing happens.

      Also I setup the relay host under the relay hosts to disable spam filter because spam filtering is done by the relay host.

      I read something about BCC headers were set with postfix earlier but now its done in rspamd. So it could be the problem that the relay host has spam filter disabled? If this is the problem exists any workaround for this?