In reality, you don't want to use the whole bulkmail machinery, which is really hairy because it attempts to use multithreading in Tcl
to stream email to multiple qmail servers in parallel, and that code was written before the nsv stuff was added to aolserver, so it is, well, too hairy.
What you do want to do is look at the code in bulkmail_sendmail.tcl,
which is a modified version of ns_sendmail, but it sets the envelope header to a custom address (i.e., the data that is sent in the SMTP command "MAIL FROM: xxxx@yyyy", rather than the "From:" header inside the mail message contents. This allows you to set the so-called envelope return address, which is where the foreign mailer will bounce message back if there is a delivery problem.
The stock ns_sendmail routine forces the "MAIL FROM:" SMTP command
to be the same as the "From:" field in the headers, effectively making it impossible to handle bounces correctly.
Once you have specified the envelope return address of your choice as a "bounce address" on your system (like maybe "mailto:my-web-mailer-errors@mysite.com";, you can configure qmail (or, God help you, sendmail) to handle
mail back to the "bounce" address in some smart way.
For the bulkmail system, we generated a unique key for the return
address of each spam, encoding the ACS user id in that key, so that we could track down the specific cause of each bounce; if you got a bounce when mailing to user 102934, you would mark his email address
as "bouncing_p = true".
The qmail
script we had merely touched a file with a unique id in a spool directory, and then
we had a tcl script which would periodically sweep that dir looking for these files, decoding their filename to find the user id, and
then marking the user's email address as "bouncing". Actually we gave them three bounces ,and then marked the address as bad.
Hope this helps. The docs in the doc/bulkmail file have some
notes on configuring qmail, but they are not complete I fear.
Good luck