Like the poster here I'm having difficulty connecting to an smtp server that uses tls. I have installed gnutls-cli but I am still getting an error, "530 5.7.0 Must issue a STARTTLS command first. ub8sm33925197wjc.39 - gsmtp". How can I tell if smtpmail.el is really finding this program? I have set up .key and .cert files, too, eventhough I'm not sure if they're necessary.

Here are all my settings:

 send-mail-function 'smtpmail-send-it
 message-send-mail-function 'smtpmail-send-it
 user-mail-address "[email protected]"
 smtpmail-starttls-credentials '(("smtp.gmail.com" "587"
           "~/.gnutls/smtp.gmail.com.key" "~/.gnutls/smtp.gmail.com.cert"))
 smtpmail-auth-credentials  (expand-file-name "~/.authinfo")
 smtpmail-default-smtp-server "smtp.gmail.com"
 smtpmail-smtp-server "smtp.gmail.com"
 smtpmail-smtp-user "[email protected]"
 smtpmail-smtp-service 587
 smtpmail-stream-type 'ssl
 smtpmail-debug-info t
 smtpmail-debug-verb t
 starttls-extra-arguments nil
 starttls-gnutls-program "/usr/bin/gnutls-cli"
 starttls-extra-arguments nil
 starttls-use-gnutls t

Many thanks.

  • Although it may not be related to your problem, depending upon what version of Emacs you are using, the variable smtpmail-starttls-credentials may no longer exist.
    – lawlist
    Sep 6, 2016 at 17:19
  • Although that seemed like a hopeful lead it didn't apply, unfortunately. Doing (require 'smptmail) in version 23.4.1 defines that variable. Thanks, though.
    – healyp
    Sep 14, 2016 at 11:36

1 Answer 1


You have hopefully figured this out by now but I think you need (setq smtpmail-stream-type 'starttls). You've specified TLS directly which won't work if the service expects unencrypted connections at first with starttls support.

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.