I've set up excorporate mode so that I can use emacs to read my outlook calendar. However I am annoyed by having to input a username/password every time I open emacs. I tried a .netrc:

machine outlook.office365.com login me@somewhere.com password 'secret'

But it doesn't work. Can anyone point me further in the right direction?

  • 2
    I'd start by setting auth-source-debug to t, and looking in the *Messages* buffer. Perhaps you need a port keyword as well (I don't see excorporate calling auth-source, so it must be calling it indirectly if at all)
    – rpluim
    Mar 25, 2019 at 21:14
  • 1
    yep, that works outlook.office365.com:443 did it Mar 25, 2019 at 22:49
  • Thank you for this useful question. Where did you put your .netrc file? Mar 24, 2020 at 15:20
  • in my home directory Mar 25, 2020 at 20:47
  • The file format and more details are explained in the manual page
    – Muihlinn
    Apr 23, 2020 at 18:16

1 Answer 1


as per the comment from @rpluim adding the port outlook.office365.com:443 did the job nicely:

machine outlook.office365.com:443 port https login john@email.com password changeme123

Don't forget that Emacs comes with built-in GPG support, so you can encrypt this file easily by naming it ~/.authinfo.gpg

  • Just to add that this also work with .authinfo file. Nov 11, 2020 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.