On Sat, 20 Jul 2024 at 06:28, timothy via Postfix-users <
postfix-users@postfix.org> wrote:

>
> When I open webmail, it always displays a dropdown menu for me to select
> an IMAP host.This is so frustrating.How to disable this drop-down menu and
> automatically match email addresses to imap hosts?
>
>
You need to use a few lines of PHP code - just create a plugin, which will
set the imap_host variable based on the email address given by the user.
Plugin is a PHP class, in its own folder under plugins/dir with filename
same as dir name. Then just add the plugin into active plugins in your
config. See examples to see other options you can change.

Something like this (simplified, as I actually take the IMAP host from
database):

class multi_imap extends rcube_plugin {
    public $task = 'login';
    public function init() { $this->add_hook('authenticate', array($this,
'authenticate')); }
    public function authenticate($args) {
        if (preg_match("~@free\.fr$~", $args["user"])) $args["host"]="
imap.free.fr";
        return $args;
    }
}
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to