Bala's Blog

Receive/send office365 emails with Gnus

October 1 2017
147 words, ~1 min. read
emacs,  gnus 

Follow the steps mentioned below to configure Gnus for receiving (via IMAP) and sending (via SMTP) office365 emails,

  1. Create ~/.gnus
(setq user-full-name "<user name>"
  user-mail-address "<email address>"
  gnus-select-method
    '(nnimap "office365"
       (nnimap-address "outlook.office365.com")
       (nnimap-server-port 993)
       (nnimap-stream ssl)
     )

  send-mail-function 'smtpmail-send-it
  smtpmail-smtp-server "smtp.office365.com"
  smtpmail-stream-type 'starttls
  smtpmail-smtp-service 587

  ;; ensure sent items are stored remotely and marked as read
  gnus-message-archive-method '(nnimap "office365")
  gnus-message-archive-group "Sent Items"
  gnus-gcc-mark-as-read t

  ;; disable agent and newsgroups
  ;; gnus-agent nil
  gnus-check-new-newsgroups nil
)

;; daemon to fetch email every 5 min when idle for 5 min
(gnus-demon-add-handler 'gnus-demon-scan-news 5 5)
(gnus-demon-init)
  1. Create ~/.authinfo[.gpg]
machine office365 login <email> password <password in plain text>
machine smtp.office365.com login <email> password <password in plain text>

Note : It's recommended to save the file with .gpg extension such that it will be secured by gnupg.

  1. Create ~/.signature (Optional)



 Regards
 Bala

References