I am trying to send mail through emacs via my gmail account. I understand that this means it is senting using SMTP.

However, when I go through the basic steps to send mail through my gmail account,

gnutls.c: [0] (Emacs) fatal error: The TLS connection was non-properly terminated.

I am following the information found here which seems very easy, however I get that error.

At first I got a warning from google about a suspicious sign in attempt, but I have enabled that and now get this strange TLS issue.

1 Answer 1


Below are my settings for sending mail through GMail:

(require 'nnir)

(setq gnus-select-method
      '(nnimap "gmail"
               (nnimap-address "imap.gmail.com")
               (nnimap-server-port 993)
               (nnimap-stream ssl)
               (nnir-search-engine imap)))

(setq send-mail-function 'smtpmail-send-it
      message-send-mail-function 'smtpmail-send-it
      '(("smtp.gmail.com" 587 nil nil))
      (expand-file-name "~/.authinfo")
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      smtpmail-debug-info t)
(require 'smtpmail)

I think that GMail listens on port 587 rather than 25, that's why there's a connection error. But that's just a guess.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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