Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.

smtp_forward for Haraka?

  • App Dev


    I'm thinking about moving some mailboxes I currently have running on iRedmail to my Cloudron instance (for this I have also created, since I would still need a way to fetch some external mailboxes).

    For this to work I would also need to relay some mailboxes to a different host. From what I could find Haraka generally supports this through Are there plans to expose this functionality in Cloudron? Is there an update safe way to configure this manually?

  • Staff

    @fbartels Did I understand correctly that you are trying import mailboxes from an existing mail server to Cloudron? If so, we have a script based on imapsync that does this. I will post in this forum shortly.

  • App Dev

    @girish said in smtp_forward for Haraka?:

    Did I understand correctly that you are trying import mailboxes from an existing mail server to Cloudron

    Kind of, but continuously. Imapsync is great for migrating single or multiple mailboxes. What I am trying to achieve is fetching mails from another inbox on a regular interval. E.g. get mails from a Hotmail mailbox every fifteen minutes.

    But that was the other post I've made, here it's more about Haraka. I want to SMTP forward mails for a given user to another system. In postfix this would be a transport.

  • How about creating a filter in Roundcube? You could then redirect incoming mail.

  • App Dev

    @hillside502 said in smtp_forward for Haraka?:

    How about creating a filter in Roundcube?

    That would as far as I know only work with a new forwarding address and therefore only with domains with a mx record. To make it a bit less abstract imagine the following scenario:

    With a transport/smtp_forward you can now only let mails to be forwarded/delivered to office 365. and you could still use the same mail archiver/anti-spam solution for this address like your whole other domain.

  • @fbartels
    You can filter to redirect any combination of TO etc addresses.

    KISS principle - Wikipedia

  • App Dev

    @hillside502 I'm not talking about the "to" or on what to filter. The "redirect" action in sieve only allows to forward to other email addresses, not other servers.

  • App Dev

    @girish any further thoughts in the use of smtp_forward with Haraka on Cloudron?

  • Staff

    @fbartels mm, I think this is a possibly a feature that we need to add to Cloudron where some mailboxes are specifically forwarded to another host.

    I can suggest a few hacks, let me know if any of these work or not:

    • Capture all the mails in Cloudron. Then make your other host pull email periodically from Cloudron via IMAP. Basically, instead of push it becomes pull.
    • If you have many mailboxes to forward, first create a mailbox named "catchall". Then forward all emails on Cloudron to this "catchall" mailbox. You can then again, pull images from another host via IMAP and distribute it as needed.
    • Another option is also to make the catchall address to be the address on a Cloudron app. On Cloudron, each app gets a unique mailbox but this can actually be renamed. This way you can have all your emails delivered to the app instead. The app can then take these emails (via IMAP/recvmail addon) and push them out. This is a bit complex since it might require some changes in the code/database to allow this setup.

    I understand it's not easy as the smtp_forward mechanism but I think to implement that will require lot more thought to see how it fits into existing Cloudron features.

  • Staff

    Looking a bit closer will only work at the domain level (and not mailbox level). @fbartels so, I am not sure if smtp_forward will work for your use case.

  • App Dev

    @girish said in smtp_forward for Haraka?:

    I am not sure if smtp_forward will work for your use case.

    oh, that is indeed true. I stumbled upon something that suggested that this could be achieved with smtp_forward, but reading the page closer this indeed would not work as desired for me.

    I'd rather want to avoid fetching mails from cloudron the the extra server. I'll have to think about some alternative approaches (maybe stick with my current relay setup and just make cloudron one of the relay targets).

    Thanks for looking into this!