> I have only seen examples of opening and closing the connections inside of
> filter_sender or filter_end. Is it possible to open a connection in
> mimedefang when it starts up and close it on exit. I would like to insert
> some information in a table from filter_relay, filter_sender and filter_end.
You can do anything you want, as long as you open the connection in
filter_initialize(), and close it in filter_cleanup() - from the man page:
If you are not using an embedded Perl interpreter, then performing
an action inside fil-
ter_initialize is practically the same as performing it directly in the
filter file, outside
any function definition. However, if you are using an embedded Perl
interpreter, then any-
thing you call directly from outside a function definition is executed
once only in the parent
process. Anything in filter_initialize is executed once per slave. If
you use any code that
opens a descriptor (for example, a connection to a database server), you
must run that code
inside filter_initialize and not directly from the filter, because the
multiplexor closes all
open descriptors when it activates a new slave.
When a slave is about to exit, mimedefang.pl calls the function
filter_cleanup (if it is
defined) with no arguments. This function can do whatever cleanup you
like, such as closing
file descriptors and cleaning up long-lived slave resources. The
return value from fil-
ter_cleanup becomes the slave's exit status.
However, you need to ensure that you either keep the database connection busy,
or configure MySQL to not use any client timeouts, since it is prone to
disconnecting clients after a while. The result of this is that your slave
dies, and the new slave gets a clean connection, so the mail will be delivered
eventually, but you are introducing delays and potential problems as a result.
Best Wishes,
Paul.
--
-------------------------------------------------------
Paul Murphy
Head of I.T.
Argenta Discovery
Tel. 01279 645 554
Fax. 01279 645 646
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang