Well it is a while ago now but I seem to recall that I modified the qmail calls to call ns_sendmail, created mail templates for the e-mails and then passed the extra header name value pairs using the ns_set functionality built into ns_sendmail.
Beware though that there are a number of mods to ns_sendmail, however I think that I documented my tracks through my daft questions which followed equally daft errors. You should find everything by looking through my posts.
Hope this helps, if I have time I will refresh my memory and post another message.
Regards
Richard