This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.

XEXEC Plugin

XEXEC is an experimental non-standard extension to the IMAP protocol that allows you to run any server side application and have it communicate with email plugins (Thunderbird) allowing custom client/server applications to communicate over an existing authenticated IMAP channel. The email client sends the XEXEC command with the name of the server side module that it wishes to run along with parameters to pass to the server. Here are some examples:

XEXEC blacklist add
XEXEC whitelist del
XEXEC changepassword MyNewPassword
XEXEC forwardmail

Uses for XEXEC

The XEXEC can be used to run anything but in theory it should be used for client server applications that relate to email or groupware applications like calendars and contact lists. Its main purpose is to allow email clients to set server side settings over the existing authenticated channel without having the user have to log in separately using a different application to control user settings. Examples of possible usage includes:

Wouldn't it be nice if you could change your email password in your email client and have it set the new password on the server at the same time? This would eliminate the need to change the server and client passwords separately. Or imagine sending outgoing email without having to configure SMTP. You just set up the incoming email and the outgoing email works as well. Or wouldn't you like to do some of the fancy tricks that Microsoft Exchange Servers do without having to use Exchange? It is our hope that this experimental protocol will lead to significant expansion of IMAP functionality.

About this Plugin

This plugin is the idea of Marc Perkel of Junk Email Filter who hired Nicolas Boullis ( to write the code. I (Marc Perkel am trying to get the concept out there in some sort of working form with the idea that it will catch on. Hopefully other people who find this concept useful will build on the idea, do it right, and perhaps some variation of this concept will eventually become a standard.


This plugin is a nonstandard experimental extension to the IMAP protocol. It is offered as a proof of concept and it is my hope that it will catch on in some form and make it into the IMAP officially. At this point there is nothing on the client side to talk to anything on the server side. So this code is presently useless until more development is done.


To activate and configure this plugin you have to first add it to your dovecot.conf file. You can do so as follows:

protocol imap {
   mail_plugins = xexec

Then to add applications you specify the module name and map it to a server side executable program.

 xexec = module:executable

Here are some examples:

plugin {
  xexec = blacklist:/usr/local/dovecot/ %u
  xexec2 = whitelist:/usr/local/dovecot/ %u
  xexec3 = average:/usr/local/dovecot/average
  xexec4 = smtp:/usr/local/dovecot/smtp

The idea is that the module name will be a reference to an executable and will hide what is happening on the server. When the command XEXEC module <parameters> is passed then the server will run the executable and pass the parameters to the executable.

Interacting with XEXEC

A typical session with XEXEC might look like this.

* OK Dovecot ready.
001 login password
001 OK Logged in.
002 xexec blacklist add
* OK Adding to server side blacklist for
002 OK command exited successfully
003 xexec changepassword MyNewPassword
* OK New Password set Sucessfully for
003 OK command exited successfully

As for the gory details:

(Stupid) example of a backend application with 2-way interaction:

function my_read () {
  printf '\05\n'
  read $1

echo 'Number of values?'
my_read count


for i in `seq $count`; do
  echo "Value #${i}:"
  my_read val
  sum=`expr $sum + $val`

echo "Average: `expr $sum / $count`"

Download and Installation


One of the purposes of developing XEXEC was to lead to SMTP over IMAP. The idea is rather than having a separate configuration for outgoing email that users would use the already authenticated IMAP session to transport outgoing email to an SMTP server which would accept it for outgoing delivery. Such a system would have several advantages.


IMAP would be a consumer to server protocol. SMTP would be a server to server protocol.


This software and the concepts behind is are free. No patent or copyrights are asserted on the concept. This is a gift to the world community. Code is released under GPL2.

Help Needed

We could use some help with this project. We haven't even started writing any client side code. We are looking for sharp people with good ideas to help develop this concept in a way that will eventually lead to becoming part of the standard. We envision that certain commands to do ordinary universal stuff (password, smtp, whit list, black list, forwarding) will become standardized so that features to set server side settings can become part of standard email applications.

None: Plugins/xexec (last edited 2012-03-15 15:26:44 by TimoSirainen)