Put the following in your ~/.gnus file, replacing all items in angle brackets with the appropriate text
(setq user-mail-address "<email address>"
      user-full-name "<full name>")

(setq gnus-select-method
      '(nnimap "<mail server name>"
	       (nnimap-address "imap.<server domain>")
	       (nnimap-server-port "imaps")
	       (nnimap-stream ssl)))

(setq smtpmail-smtp-server "smtp.<server domain>"
      smtpmail-smtp-service 587
      gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")

Put the following in your ~/.authinfo file or better yet, in ~/.authinfo.gpg which will be automatically encrypted with GnuPG
(see GnusAuthinfo and GnusEncryptedAuthInfo, as well as the ‘auth’ info node in emacs using C-h i d m auth RET),
replacing <USER> with your email address and replacing <PASSWORD> with your application-specific password
machine login <USER> password <PASSWORD> port imaps
machine login <USER> password <PASSWORD> port 587

Run M-x gnus and enjoy.
Some content on this page was derived from Emacs Wiki used under CC-SA license
The Gnus manual may be found at