Milter smfi_main()

Run the Milter All sendmail versions

The smfi_main() routine starts Milter running and, if you have not already called the smfi_opensocket() routine (Milter smfi_opensocket() on page 1193), establishes the listening socket. The smfi_main() routine takes no argument and is called like this:

ret = smfi_main();

Here, the returned integer value ret will contain either MI_FAILURE if the Milter failed to start, or MI_SUCCESS if the Milter ran and exited normally. A Milter can fail to start up because it could not establish a listening socket, or because of a system or memory error. Usually, failure to start is logged with syslog().

Note that smfi_main() does not put your program into the background to run as a daemon. You need to write that code yourself.

The clean way to shut down your Milter is by calling the smfi_stop() routine (Milter smfi_stop() on page 1202).

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.