-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, November 19 at 11:01 PM, quoth Michael Kjorling: >I am trying to automate sending certain messages, using a script to >call Mutt 1.5.16 (on Linux). It is working fine, except that despite >there being a folder-hook that should (and as far as I can tell from >the maillog does) get invoked setting among other things $record, no >copy of the outgoing message is saved there, or apparently anywhere >else for that matter. This is fairly important in my case.
When you send a message automatically via a script, mutt does not open any folders (-f arguments are IGNORED), and thus the folder-hooks are not triggered. Think about it: why open a folder if you're being told to send a message and then exit? There's no reason to, which is why mutt doesn't do it, which is why your folder-hook isn't getting triggered. That's why I prefer to use folder-hooks exclusively for things relevant to using mutt interactively---things like mailing list settings are (in my opinion) better if done using a send-hook or reply-hook or something like that. If you need to set $record for this script, one easy way of doing it is to specify that on the commandline, with the -e flag. Here's how I would rewrite your script: #!/bin/bash # Use mktemp properly FILE=$(mktemp -q -t muttattachment-XXXXXXXXXXXX ) # Test the return value and the writeable/existence of $FILE [ $? == 0 -a -f "$FILE" -a -w "$FILE" ] || exit -1 cat - > "$FILE" mutt -a "$FILE" \ -e "set record=+somewhere" \ -R -s "subject" -- \ "[EMAIL PROTECTED]" # clean up after myself rm -f "$FILE" Another way to do it is by, like I mentioned, using a send-hook, e.g.: send-hook '~C [EMAIL PROTECTED]' 'set record=+somewhere' ~Kyle - -- Those who can make you believe absurdities can make you commit atrocities. -- Voltaire -----BEGIN PGP SIGNATURE----- Comment: Thank you for using encryption! iD8DBQFHQhtzBkIOoMqOI14RAnopAJsGT12TmZulXJJI79XcWKwutMoCIQCdFV8m Pc2PlvR+/dvYe/xJL3NgPi8= =j3TA -----END PGP SIGNATURE-----