mutt IMAP configuration for outlook.office365.com

Greg Marks gtmarks at gmail.com
Thu Mar 12 19:32:13 UTC 2020


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 mutt-users-request at mutt.org <mutt-users-request at mutt.org>
of March 12, 2020, 12:00:03 +0000, follows:
> Send Mutt-users mailing list submissions to
> 	mutt-users at mutt.org
> 
> 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
> 	mutt-users-request at mutt.org
> 
> You can reach the person managing the list at
> 	mutt-users-owner at mutt.org
> 
> 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 <gtmarks at gmail.com>
> To: mutt-users at mutt.org
> Subject: mutt IMAP configuration for outlook.office365.com
> Message-ID: <736f1e49-2298-f1a4-2047-d4e192bf694e at gmail.com>
> 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 <sampablokuper at posteo.net>
> To: mutt-users at mutt.org
> Subject: Re: mutt IMAP configuration for outlook.office365.com
> Message-ID: <20200312103512.y6dhhfedpxx5m6e6 at posteo.net>
> 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
> Mutt-users at mutt.org
> 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.asc>


More information about the Mutt-users mailing list