Hi Greg,

I'm glad everything is working for you now.

On Sun, Mar 15, 2020 at 09:20:03PM -0500, Greg Marks wrote:
For the benefit of anyone else who may have these problems, a possible
.muttrc configuration file that one can use for IMAP access to
outlook.office365.com e-mail accounts contains the following lines:

  set password_variable="`/usr/bin/ccrypt -c <password_file>.cpt`"

Note for others that user defined variables have to begin with "my_". See <http://www.mutt.org/doc/manual/#set-myvar>. I'm assuming you "paraphrased" for your muttrc example in this case.

The one thing that had not been entirely clear to me was that you can use single-quotes after the account-hook declaration without unintentionally defining imap_pass as the literal string $password_variable.

This is a confusing point.  In hooks that have a command string, such as
account-hooks, the command string will end up being evaluated twice.

The first time is when the entire account-hook line is read in by Mutt. If the command string uses double quotes (or no quotes), variable interpolation and other string evaluations will occur right then. The resulting command string will then be associated with the hook and stored away.

Later on, when a hook matches, Mutt will then evaluate and run the stored away command string. Evaluating is just like when reading in the muttrc: each argument of the command string will have interpolation performed if it isn't single quoted.

So, if you want to defer evaluation of variables until execution time, the command string should be enclosed in single quotes.

I would still be interested to understand why the line:

  account-hook $folder 'set imap_user=<email_local_part>@<univ_domain> 
imap_pass=$password_variable'

is needed in a .muttrc file for which this is the only account.

If you only have one account, and have defined $imap_user and $imap_pass elsewhere, the hook is not needed. I would suggest commenting it out.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to