Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (55 sloc) 3.47 KB

Structure MQ_Connection

The MQ_Connection structure is passed to all callbacks dealing with SMTP connections. It allows your plugin to find out information about the connection, and to send data over the connection.

Functions that your plugin can export

There is a whole list of functions that your plugin can export that deal with connections.

mq_smtp_in_connect() Called after an incoming TCP connection is established. This is the first time that the MQ_Connection is passed to the plugin, and a good place for per-connection initialization code.
mq_smtp_in_secure() Called when the STARTTLS instruction is received and the connection is turned into a secure connection
mq_smtp_in_authenticate() Called when the SMTP client sends the login+password credentials. Allows you to run your own authentication checks.
mq_smtp_in_mailfrom() Called when the "MAIL FROM" command is received
mq_smtp_in_rcptto() Called when the "RCPT TO" command is received
mq_smtp_in_data() Called when the "DATA" command is received
mq_smtp_in_message() Called when a message is received. When multiple "RCPT TO" addresses were given, this function is called once for each address.
mq_smtp_in_close() Called after an incoming SMTP connection is closed. This is the last time that the MQ_Connection is passed to the plugin. You can use this function for cleanup code.

The above functions are only called for MQ_Connection pointers that represent incoming connections.

Access to connection properties

All members in the MQ_Connection structure are private. To interact with the structure the following accessor functions have been created.

Callable function Description
MQ_fileDescriptor() Retrieve the filedescriptor linked to a connection
MQ_send() Send data over a SMTP connection
MQ_authenticated() Returns whether this is an authenticated connection
MQ_setAuthenticated() Mark a connection as an authenticated connection
MQ_secure() Returns whether this is a secure TLS connection
MQ_connectionData() Retrieve the data that is associated with the SMTP connection
MQ_setConnectionData() Associated data with the SMTP connection
You can’t perform that action at this time.