Re: Sending message from command line, I get no fcc
- To: mutt-users@xxxxxxxx
- Subject: Re: Sending message from command line, I get no fcc
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Mon, 19 Nov 2007 17:25:40 -0600
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date:from:to:subject:message-id:references:mime-version:content-type:in-reply-to; q=dns/txt; s=default; bh=wk5oSYgCDwaGm3JFMfJG+p1yPh0=; b=mcjt6edaBAt6guiHXutAJBpiY7BYOYExAs4MQdJ4yVr+H7nAQKcCGiN4ldaPqA32JoNSFVNraWoPOE7kjJp4HBmQIEjsCR1uiRzPG6bGKTGOR99YfHtExiyZgnyhTwc8gyDkQfoszGnYmMLm7raPd+5754CVCgTJ4DRnNdI4DSw=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=AqmIuMJPqRw3t98ZMUgPq+OjVbooupNecAQymeEF8nIOhY8gdEX8GoCFUa7Z1dodea8y58/M7jwoEFdk4SCM7RmouunpwMu9nOckwom31RHTXkuy5f0xfaFOSRNe8OVlwi62k0No75vcDfkukmqbgYqwY4SgZKWs5jkdg81NILc=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent;
- In-reply-to: <20071119230106.GQ20580@xxxxxxxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- References: <20071119230106.GQ20580@xxxxxxxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.17 (2007-11-15)
-----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" -- \
"recipient@address"
# 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 recipient@address' '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-----