Template file Ispconfig to create basic folders in mailbox

Discussion in 'ISPConfig 3 Priority Support' started by gscaglia, Jul 15, 2019.

  1. gscaglia

    gscaglia Member HowtoForge Supporter

    Hi Till,
    when I open a new mailbox, Ispconfig creates some default folders, especially Sent, Junk, Drafts and Trash.

    Each e-mail client (in Imap), on each device, then creates its special folders, which in Italy are also translated into Italian, and therefore for each of those folders at least two more are created (eg for the Sent folder: Sent Messages for IOS devices and "Posta inviata" for Outlook).

    To make the user experience of our customer better, in addition to the folders above, we decided to create the other folders, as a symbolic link, already during the creation of the email box.

    In this way, for example, when a user sends an email with his iPhone, he will also find a copy in the .Sent folder of Roundcube and in the "Posta inviata" folder in Outlook.

    Is it possible to act on an Ispconfig configuration file in order to already get the folders with symbolic links when opening the email box?

    Thanks a lot
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    No, that's not template based. You will have to write a small ISPConfig plugin which binds itself to the mailbox create event to do that. Have a look at the existing email plugins in ispconfig server part to get an idea how this works.
  3. gscaglia

    gscaglia Member HowtoForge Supporter

    Do you mean this file? /usr/local/ispconfig/server/plugins-available/mail_plugin.inc.php

    In that file there are instructions for creating folders, like
    exec("su -c 'doveadm mailbox create -u \"".$data["new"]["email"]."\" Sent'");
    May I integrate the instructions in that file?

    Last edited: Jul 15, 2019
  4. till

    till Super Moderator Staff Member ISPConfig Developer


    You can do that but your changes will get removed on every ISPConfig update, that's why I recommended to create an additional plugin as that#s the update-safe way.
  5. florian030

    florian030 ISPConfig Developer ISPConfig Developer

  6. gscaglia

    gscaglia Member HowtoForge Supporter

    For example, if I duplicated the file /usr/local/ispconfig/server/plugins-available/mail_plugin.inc.php changing its name to mail_symlink_plugin.inc.php, I would also modify the class name (and the values of the first two variables) in it as well as the instructions for creating symbolic folder links in Maildir of the mailbox (deleting everything that is not needed), and finally putting the symlink in / usr / local / ispconfig / server / plugins-enable I would have created an additional, working, Ispconfig plugin?

    It would be a perfect solution but I tried to add for example
      mailbox virtual/"Posta inviata" {
        auto = create
        special_use = \Sent
        comment = cartella Posta inviata per Outlook
    in the file /etc/dovecot/conf.d/15-mailboxes.conf (I use Debian 9 with Dovecot 2.2.27), when I create a new mailbox with Ispconfig (and open it in Outlook) nothing happens to the usual: Outlook creates a "Posta inviata" folder that is completely independent of the .Sent folder.

    I find little documentation on creating folders as a symbolic link in mailboxes, do you have any ideas?
  7. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    it's /etc/dovecot/dovecot.conf
    gscaglia likes this.
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, but you'll have to remove most of the program code from that file and keep just the skeleton and then add your code to ensure that no duplicate code gets executed.
    gscaglia likes this.
  9. gscaglia

    gscaglia Member HowtoForge Supporter

    The Dovecot configuration changes don't work for me, even if I put the instructions in the file /etc/dovecot/dovecot.conf

    I also found a perfect Dovecot plugin for my needs (Mailbox alias plugin https://wiki2.dovecot.org/Plugins/MailboxAlias) but I can't get it to go.

    The idea of the Ispconfig additional plugin, attracts me a lot, even for future needs, but I'm afraid of wasting too much time, so for the moment I solved it with a manual Shell script.

    Thanks for everything
    Last edited: Jul 17, 2019

Share This Page