IndiMail now has a plugin functionality for qmail-smtpd. You can write your own plugin to carry out tasks during the MAIL, RCPT or the DATA phase of SMTP. See the man page for plugin_init(3) for details.
NAME
plugin_init() - Template for Dynamic SMTP Plugins
SYNTAX
#include smtp_plugin.h
char *from_plug(char *rip, char *from, char **mesg);
char *rcpt_plug(char *rip, char *from, char *rcpt, char **mesg);
char *data_plug(char *local, char *rip, char *rhost, char *rinfo, char **mesg);
PLUGIN *plugin_init();
typedef struct
{
int (*mail_func) (char *, char *, char **);
int (*rcpt_func) (char *, char *, char *, char **);
int (*data_func) (char *, char *, char *, char *, char **);
} PLUGIN;
DESCRIPTION
PLUGIN structure has three components: mail_func is a pointer to function to be exe‐
cuted in the SMTP MAIL session. rcpt_func is a pointer to function to be executed in
the SMTP RCPT session. data_func is a pointer to function to be executed in the SMTP
DATA session.
To write a SMTP plugin you have to write the plugin_init() function. Depending on
which phase of SMTP (MAIL, RCPT, DATA) you want to call your function, you have to
write the from_plug, rcpt_plug, data_plug functions.
The plugin_init() function can be written as below
PLUGIN *
plugin_init()
{
static PLUGIN plug;
PLUGIN *ptr;
ptr = &plug;
ptr->mail_func = from_plug;
ptr->rcpt_func = rcpt_plug;
ptr->data_func = data_plug;
return &plug;
}
To compile the plugin you can use gcc(1).
gcc -shared -rdynamic -nostartfiles -fPIC -s -O4 -o smtpd-plugin.so smtp_plugin.o
RETURN VALUE
The functions from_plug, rcpt_plug, data_plug must return 0 on success. These func‐
tions should return 1 to terminate the sesson with a message. You can set your own
message by assigning mesg variable. If you have the below function in smtpd-plugin.so
int
rcpt_plug(char *remoteip, char *from, char *rcpt, char **mesg)
{
if (!strstr(rcpt, "@yahoo.com"))
{
*mesg = "530 We are serious and don't Yahoo (#5.7.1)
return (1);
}
return (0);
}
SEE ALSO
qmail-smtpd(8), dlopen(3), gcc(1)
IndiMail is a Secure, Reliable, Efficient Messaging Platform which provides you everything needed in a modern messaging server - ESMTP, IMAP, POP3, QMTP, QMQP and many other features. IndiMail gives you speeds that are faster than most MTAs. The flexibility provided by IndiMail's authentication methods allow any IMAP/POP3 server to be used with IndiMail. IndiMail is built for speed and flexibility. You can download the source or use the binary RPM generated by openSUSE Build Service.
Subscribe to:
Post Comments (Atom)
IndiMail Queue Mechanism
Indimail has the ability of configuring multiple local and remote queues. A queue is a location on your hard disk where email are deposited ...
-
IndiMail now has docker images. You can read about installing Docker here . Once you have installed docker-engine, you need to start it. Ty...
-
Installing Indimail using YUM/APT Repository Install OS OpenSUSE openSUSE Leap 42.3 openSUSE Leap 42....
-
What is DKIM DomainKeys Identified Mail ( DKIM ) lets an organization take responsibility for a message while it is in trans...
No comments:
Post a Comment