Dear Mr. McCarthy, Thank you for your suggestions, which completely solved my problem! I can now read and send e-mail through this account.
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`" set imap_user=<username_local_part>@<univ_domain> set imap_pass="$password_variable" set folder="imaps://<username_local_part>%40<univ_domain>@outlook.office365.com/" set spoolfile="+Inbox" set postponed="+Drafts" set record="+Sent" mailboxes = +Sent +Drafts +Trash set smtp_url="smtp://<username_local_part>%40<univ_domain>@outlook.office365.com:587/" set smtp_pass="$password_variable" set realname="<My Name>" set from="<email_local_part>@<univ_domain>" set hostname="<univ_domain>" set signature="<My Name>" set use_from=yes set use_envelope_from=yes set ssl_force_tls = yes set smtp_authenticators = "login" account-hook $folder 'set imap_user=<email_local_part>@<univ_domain> imap_pass=$password_variable' where <password_file>.cpt is a ccrypt-encrypted file with one line consisting solely of the e-mail account password, which may contain special characters. I do apologize for asking a question that was largely answered in Example 3.6 of the manual (http://www.mutt.org/doc/manual/). 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. A possible point of confusion is that in Thunderbird the outgoing server (SMTP) settings list the server name as smtp.office365.com, whereas the line in the .muttrc file setting the smtp_url variable uses outlook.office365.com. (This was one of the things I had tried changing when sending e-mail via mutt didn't work.) Maybe the two SMTP server names are interchangeable; I haven't bothered to tinker with it now that it works. 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. It would seem that the authentication settings have already been set earlier in .muttrc, but I guess mutt needs to hear them again when it opens the mailbox on the IMAP server? This question is of no particular urgency, but I am curious. Concerning one final point that came up: my IMAP and SMTP passwords for this account are indeed that same. I've never seen an account where they're different, although since the SMTP and IMAP servers are distinct, I suppose it's theoretically possible that they could use different authentication information. Best regards, Greg Marks Message from [email protected] <[email protected]> of March 13, 2020, 12:00:03 +0000, follows: > Send Mutt-users mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.mutt.org/mailman/listinfo/mutt-users > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Mutt-users digest..." > > > Today's Topics: > > 1. Re: mutt IMAP configuration for outlook.office365.com > (Kevin J. McCarthy) > 2. Re: mutt IMAP configuration for outlook.office365.com (Greg Marks) > 3. Re: mutt IMAP configuration for outlook.office365.com (Sam Kuper) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 12 Mar 2020 08:05:47 -0700 > From: "Kevin J. McCarthy" <[email protected]> > To: [email protected] > Subject: Re: mutt IMAP configuration for outlook.office365.com > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii"; Format="flowed" > > On Wed, Mar 11, 2020 at 06:55:14PM -0500, Greg Marks wrote: > >Up until recently this worked perfectly. It began to fail, however, > >after I changed my e-mail account password to something containing a > >dollar sign, of the form abc$def. > > Hi Greg, > > I have a couple suggestions to try. The first is to change your > <password_file>.cpt to only contain the password, instead of mutt > commands. > > Then in your .muttrc put: > set password_variable="`/usr/bin/ccrypt -c <password_file>.cpt`" > The backquotes inside double quotes causes the password to be assigned > without any further processing. > > The next thing to try is putting the account-hook command in single > quotes: > account-hook $folder 'set imap_user=<email_local_part>@<univ_domain> > imap_pass=$password_variable' > > That will prevent mutt from substituting the password while reading in > the account-hook, and then evaluating the password while running the > account hook command. > > >The remaining problem is that while this allows me to read e-mail, I am > >unable to send e-mail. Sending e-mail fails with the error message > >"SASL authentication failed." > > My best guess is what Sam Kuper mentioned. There may be a disconnect > between your IMAP and SMTP password. I would make sure that you changed > both passwords. It may be the SMTP password is still the old IMAP > password. > > >It would be great to get some authoritative guidance on this! > > I'd suggest reading http://www.mutt.org/doc/manual/#muttrc-syntax > closely. Single quotes don't evaluate anything. The only issue is > embedded single quotes, which need to be embedded like this: > set foo='embedded'\''quote' > > That's why I suggested just using > set foo="`/usr/bin/ccrypt ...`'" > which bypasses the problem. > > -- > Kevin J. McCarthy > GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: signature.asc > Type: application/pgp-signature > Size: 833 bytes > Desc: not available > URL: > <http://lists.mutt.org/pipermail/mutt-users/attachments/20200312/2139fdd6/attachment-0001.asc> > > ------------------------------ > > Message: 2 > Date: Thu, 12 Mar 2020 14:32:13 -0500 > From: Greg Marks <[email protected]> > To: [email protected] > Subject: Re: mutt IMAP configuration for outlook.office365.com > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii" > > Dear Mr. Kuper, > > Thank you for your advice. > > > I would suggest attempting the same workaround that you used for the > > IMAP password. I.e. escape the dollar sign in the smtp_pass field with > > a backslash. > > But haven't I already done this via these two lines in my .muttrc file? > > set imap_pass="$password_variable" > set smtp_pass="$password_variable" > > The encrypted file <password_file>.cpt read at the start of .muttrc > contains one line, of the form: > > set password_variable='abc\$def' > > Best regards, > Greg Marks > > Message from [email protected] <[email protected]> > of March 12, 2020, 12:00:03 +0000, follows: > > Send Mutt-users mailing list submissions to > > [email protected] > > > > To subscribe or unsubscribe via the World Wide Web, visit > > http://lists.mutt.org/mailman/listinfo/mutt-users > > or, via email, send a message with subject or body 'help' to > > [email protected] > > > > You can reach the person managing the list at > > [email protected] > > > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of Mutt-users digest..." > > > > > > Today's Topics: > > > > 1. mutt IMAP configuration for outlook.office365.com (Greg Marks) > > 2. Re: mutt IMAP configuration for outlook.office365.com (Sam Kuper) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Wed, 11 Mar 2020 18:55:14 -0500 > > From: Greg Marks <[email protected]> > > To: [email protected] > > Subject: mutt IMAP configuration for outlook.office365.com > > Message-ID: <[email protected]> > > Content-Type: text/plain; charset="utf-8" > > > > Dear Mutt-users List Members: > > > > I have set up mutt for use with my university e-mail account (which uses > > outlook.office365.com) via IMAP. The relevant part of my .muttrc file for > > this e-mail account looks like this: > > > > source "/usr/bin/ccrypt -c <password_file>.cpt |" > > set imap_user=<username_local_part>@<univ_domain> > > set imap_pass="$password_variable" > > set > > folder="imaps://<username_local_part>%40<univ_domain>@outlook.office365.com/" > > set spoolfile="+Inbox" > > set postponed="+Drafts" > > set record="+Sent" > > mailboxes = +Sent +Drafts +Trash > > set > > smtp_url="smtp://<username_local_part>%40<univ_domain>@outlook.office365.com:587/" > > set smtp_pass="$password_variable" > > set realname="<My Name>" > > set from="<email_local_part>@<univ_domain>" > > set hostname="<univ_domain>" > > set signature="<My Name>" > > set use_from=yes > > set use_envelope_from=yes > > set ssl_force_tls = yes > > set smtp_authenticators = "login" > > account-hook $folder "set imap_user=<email_local_part>@<univ_domain> > > imap_pass=$password_variable" > > > > (The password is stored in a ccrypt-encrypted file, where > > $password_variable is set. A slight complication is that > > <username_local_part> and <email_local_part> are different due to my > > university's setup, but I can send and receive e-mail from either. Some of > > the configurations were copied from a working Thunderbird setup--ports, > > authentication method, etc.--although I prefer mutt to Thunderbird.) > > > > Up until recently this worked perfectly. It began to fail, however, after > > I changed my e-mail account password to something containing a dollar sign, > > of the form abc$def. This caused the mutt IMAP connection to fail, with > > error messages such as "Could not find the host outlook.office365.com," and > > no e-mail would be displayed. I was able to fix these connection problems > > by escaping the dollar sign in the password, redefining $password_variable > > in the encrypted file to something of the form abc\$def. (Past passwords > > containing dollar signs did not cause a problem; the problem seems to occur > > when the dollar sign precedes a letter.) > > > > The remaining problem is that while this allows me to read e-mail, I am > > unable to send e-mail. Sending e-mail fails with the error message "SASL > > authentication failed." > > > > My suspicion is that the problem lies with the last, account-hook line in > > my .muttrc file, where imap_pass is defined within double-quotes. > > Enclosing $password_variable within an extra set of double-quotes on this > > line does not remedy the problem. (To be honest, I don't understand why > > the account-hook line is necessary, but connections definitely fail without > > it.) > > > > Can anyone tell me whether my account-hook line is indeed the problem, and > > what the correct syntax should be? And, for future reference, are there > > other characters in a password that need to be escaped? > > > > There is a small amount of information, mixed in with misinformation, that > > Web searches unearth, e.g. > > > > > > https://askubuntu.com/questions/81924/sasl-authentication-failed-with-mutt-and-gmail-why > > https://wiki.archlinux.org/index.php/Mutt > > > > It would be great to get some authoritative guidance on this! > > > > Best regards, > > Greg Marks > > > > -------------- next part -------------- > > A non-text attachment was scrubbed... > > Name: signature.asc > > Type: application/pgp-signature > > Size: 833 bytes > > Desc: OpenPGP digital signature > > URL: > > <http://lists.mutt.org/pipermail/mutt-users/attachments/20200311/5121d168/attachment-0001.asc> > > > > ------------------------------ > > > > Message: 2 > > Date: Thu, 12 Mar 2020 10:35:12 +0000 > > From: Sam Kuper <[email protected]> > > To: [email protected] > > Subject: Re: mutt IMAP configuration for outlook.office365.com > > Message-ID: <[email protected]> > > Content-Type: text/plain; charset=us-ascii > > > > On Wed, Mar 11, 2020 at 06:55:14PM -0500, Greg Marks wrote: > > > my university e-mail account [..] uses outlook.office365.com [..] > > > > Commiserations. Universities used to be capable of hosting their own > > email servers. > > > > > > > It would be great to get some authoritative guidance on this! > > > > Here is my guidance. I would not call it authoritative! > > > > > > > [..] The relevant part of my .muttrc file for this e-mail account > > > looks like this: > > > > > > source "/usr/bin/ccrypt -c <password_file>.cpt |" > > > set imap_user=<username_local_part>@<univ_domain> > > > set imap_pass="$password_variable" > > > [..] > > > set smtp_pass="$password_variable" > > > [..] > > > set smtp_authenticators = "login" > > > account-hook $folder "set imap_user=<email_local_part>@<univ_domain> > > > imap_pass=$password_variable" > > > > > > [..] Up until recently this worked perfectly. It began to fail, > > > however, after I changed my e-mail account password to something > > > containing a dollar sign, of the form abc$def. This caused the mutt > > > IMAP connection to fail, with error messages such as "Could not find > > > the host outlook.office365.com," and no e-mail would be displayed. I > > > was able to fix these connection problems by escaping the dollar sign > > > in the password, redefining $password_variable in the encrypted file > > > to something of the form abc\$def. [..] > > > > > > The remaining problem is that while this allows me to read e-mail, I > > > am unable to send e-mail. [..] > > > > I suspect that that remaining problem occurs because email clients use > > the SMTP credentials, not IMAP credentials, to send email. > > > > I would suggest attempting the same workaround that you used for the > > IMAP password. I.e. escape the dollar sign in the smtp_pass field with > > a backslash. > > > > Let us know if this works. > > > > Sam > > > > -- > > A: When it messes up the order in which people normally read text. > > Q: When is top-posting a bad thing? > > > > () ASCII ribbon campaign. Please avoid HTML emails & proprietary > > /\ file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you. > > > > > > ------------------------------ > > > > Subject: Digest Footer > > > > Mutt-users mailing list > > [email protected] > > http://lists.mutt.org/mailman/listinfo/mutt-users > > > > > > ------------------------------ > > > > End of Mutt-users Digest, Vol 96, Issue 1 > > ***************************************** > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: signature.asc > Type: application/pgp-signature > Size: 833 bytes > Desc: not available > URL: > <http://lists.mutt.org/pipermail/mutt-users/attachments/20200312/71aeee0a/attachment-0001.asc> > > ------------------------------ > > Message: 3 > Date: Fri, 13 Mar 2020 02:14:51 +0000 > From: Sam Kuper <[email protected]> > To: [email protected] > Subject: Re: mutt IMAP configuration for outlook.office365.com > Message-ID: <[email protected]> > Content-Type: text/plain; charset=us-ascii > > On Thu, Mar 12, 2020 at 02:32:13PM -0500, Greg Marks wrote: > > Dear Mr. Kuper, > > Please don't address me as "Mr", but anyhow... > > >> I would suggest attempting the same workaround that you used for the > >> IMAP password. I.e. escape the dollar sign in the smtp_pass field > >> with a backslash. > > > > But haven't I already done this via these two lines in my .muttrc > > file? > > > > set imap_pass="$password_variable" > > set smtp_pass="$password_variable" > > > > The encrypted file <password_file>.cpt read at the start of .muttrc > > contains one line, of the form: > > > > set password_variable='abc\$def' > > Yes, I think you are correct. > > Sorry for not spotting earlier that both those two lines in your .muttrc > reference the same variable. > > Sam > > > -- > A: When it messes up the order in which people normally read text. > Q: When is top-posting a bad thing? > > () ASCII ribbon campaign. Please avoid HTML emails & proprietary > /\ file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you. > > > ------------------------------ > > Subject: Digest Footer > > Mutt-users mailing list > [email protected] > http://lists.mutt.org/mailman/listinfo/mutt-users > > > ------------------------------ > > End of Mutt-users Digest, Vol 96, Issue 2 > *****************************************
signature.asc
Description: PGP signature
