I’m trying to use nmh’s “draftfolder” feature to queue outgoing mail for later delivery.
The key step I don’t know how to implement is how to write a program that will send a message from a draft folder.
Here’s the workflow I’m trying to achieve:
-
I compose a message using the
comporreplprograms, and I quit with the message unsent, leaving it in the “draft folder”+delay4. -
Sometime after four hours have elapsed, a cron job comes along and sends the message, removing it from the draft folder.
Here are the difficulties I’m having with existing MH commands
-
The
comp -usecommand can send an existing message from a draft folder, but it requires interaction. I want to do this noninteractively from a cron job, and I’d prefer not to try to write an expect script. I triedcomp -use -noedit -nowhatnowprocbut that did not send the message. I don’t know if some kind of alternate
whatnowprogram would do the trick. -
The
sendandpostcommands look promising, but both expect to operate on files, not messages in folders. Maybesendfollowed byrmmworks, maybe it doesn’t. -
I could go direct to sendmail, but then I would have to figure out whether to run
mhbuildor not. And I would seem to have the same issue of needing to remove the message from the folder.
My question is how can I use the MH API in a script to send a message that is sitting in a draft folder?
RTFM.
The
sendcommand’s-draftfolderoption makes it work on messages, not files.Perfect for what I want. If you want to be extra explicit, use the
-draftmessageoption as well.