3

I tried the following settings in order to work M-x diary-mail-entries but it fails. My question is how to put the correct settings in order to be able to work with M-x diary-mail-entries in Emacs.

(setq user-full-name "My name")
(setq user-mail-address "my_user_name@gmail.com")

(setq send-mail-function 'smtpmail-send-it
message-send-mail-function 'smtpmail-send-it
smtpmail-starttls-credentials
'(("smtp.gmail.com" 587 nil nil))
smtpmail-auth-credentials
(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 get the error

Sending via mail...
gnutls.c: [1] (Emacs) GnuTLS library not found
530 5.7.0 Must issue a STARTTLS command first. u9sm80344949wjy.37 - gsmtp
221 2.0.0 closing connection u9sm80344949wjy.37 - gsmtp
smtpmail-send-it: Sending failed: 530 5.7.0 Must issue a STARTTLS command first. u9sm80344949wjy.37 - gsmtp
  • As you've set smtpmail-debug-info to t, you should have a buffer called *trace of SMTP session to smtp.gmail.com* after a failed attempt to send a message. Could you paste the contents of that buffer into your question? – legoscia Jan 6 '15 at 18:09
  • @legoscia done. – Name Jan 6 '15 at 18:14
  • 1
    Are you using Windows? I wrote a little guide to installing GnuTLS DLLs for Emacs, which seems to be what's missing here. – legoscia Jan 6 '15 at 18:53
  • @legoscia, I use windows. Thank you for the link. – Name Jan 6 '15 at 19:10
  • 1
    @legoscia Thank you, your little guide was very useful and solved my problem. – Name Jan 6 '15 at 20:10
4

smtpmail-send-it: Sending failed: 530 5.7.0 Must issue a STARTTLS command first. u9sm80344949wjy.37 - gsmtp

You did not start tls, you need it to open a TLS connection to your gmail account.

Not a direct answer to your request, but this is an Emacs configuration for sending mails with gmail. The gnutls package should be installed system wide ex: apt install gnutls-bin:

;; send mail
(setq
send-mail-function 'smtpmail-send-it
message-send-mail-function 'smtpmail-send-it
user-mail-address "youremail@gmail.com"
smtpmail-starttls-credentials '(("smtp.gmail.com" "587" nil nil))
smtpmail-auth-credentials (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
starttls-extra-arguments nil
starttls-gnutls-program "/usr/bin/gnutls-cli"
starttls-extra-arguments nil
starttls-use-gnutls t
)

Make sure to insert the correct email address and the correct path to gnutls-cli.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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