mutt IMAP configuration for outlook.office365.com

Greg Marks gtmarks at gmail.com
Wed Mar 11 23:55:14 UTC 2020


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.asc>


More information about the Mutt-users mailing list