in reply to Sending email using qmail

qmail-inject is the cli tool for injecting a new email into the delivery que. Like so many Mail Transfer Agents, its written to replicate the functionality of sendmail. I'd bet on inspection you might find that /usr/bin/sendmail is simply a symlink to qmail-inject.

man qmail-inject ought to spell out the details. I switch between using mailx (or nail when I need to control the From: line in the headers), or Mail::Mailer, which as I recall takes a hash ref to the header parameters, and permits you to open, print to then close the $mail handle, as if it were any other filehandle. On close its handed off to the mta.

-- Hugh