(add-hook 'nntp-server-opened-hook (lambda () (cond ((string-match "relay" nntp-address) (nntp-send-nosy-authinfo-from-file)) (t )))) (defun nntp-send-nosy-authinfo-from-file () "Send the AUTHINFO to the nntp server, including username and password This function is supposed to be called from `nntp-server-opened-hook'." (when (file-exists-p "~/.nntp-authinfo") (nnheader-temp-write nil (insert-file-contents "~/.nntp-authinfo") (goto-char (point-min)) (nntp-send-command "^.*\r?\n" "AUTHINFO USER" (buffer-substring (point) (progn (end-of-line) (point)))) (goto-line 2) (nntp-send-command "^.*\r?\n" "AUTHINFO PASS" (buffer-substring (point) (progn (end-of-line) (point)))))))