qpsmtpd Wiki


You are here: start » api


You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.


You don't have an account yet? Just get one: Register

Forgotten your password? Get a new one: Set new password

Plugin API


The qpsmtpd plugins are a flexible way of expanding and adapting the functionality of qpsmtpd. If the existing plugins don't do what you need (or want), you might want to write your own plugin or adapt one of the existing ones.

For now, the best documentation available is README.plugins …new since rev 769: plugins.pod

You may also want to look at the documentation for plug-in hooks, authentication plug-ins, and logging plug-ins. Hooks will usually return a return value that tells qpsmtpd how to proceed.


These vars will be mentioned down below without a description (FIXME: this should be in the plugin api page :))


The plugin object itself, any plugin will have this. This is created at plugin loading time.


A Qpsmtpd::Transaction object. This object describes the current transaction (i.e. the currently incoming message) not the connection. It will be reset after the current mail was sent to the queue hook (or we or the client ends the connection :)). It can be used to store / access info across plugins via the notes method. ($transaction→notes()), see perldoc Qpsmtpd::Transaction fore more info. Most plugins with more than one hook use this to keep a state for this transaction, as this will be reset at the end of a transaction.


A Qpsmtpd::Connection object. This describes the current connection, it can be valid for more than one transaction. If not given as argument, it can be accessed as $self→qp→connection, for example: my $client_ip = lc $self→qp→connection→remote_ip; It can be used to store / access info across plugins AND across transactions via the notes method, like the $transaction→notes() described above. This will be reset at the end of a connection.

Someone should write about the $self, $transaction and $connection elements, hopefully without digging to deep into perl OOP.


returns the note on a connection named by the key.

$connection->notes($key, $value)

sets, and then returns, the note on a connection named by the key.

We should also give the reader a walk-through of the demo plugin here.