5

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
Name
  • 7,689
  • 4
  • 38
  • 84
  • 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 06 '15 at 18:09
  • @legoscia done. – Name Jan 06 '15 at 18:14
  • 1
    Are you using Windows? I wrote [a little guide](http://xn--9dbdkw.se/diary/how_to_enable_GnuTLS_for_Emacs_24_on_Windows/index.en.html) to installing GnuTLS DLLs for Emacs, which seems to be what's missing here. – legoscia Jan 06 '15 at 18:53
  • @legoscia, I use windows. Thank you for the link. – Name Jan 06 '15 at 19:10
  • 1
    @legoscia Thank you, your little guide was very useful and solved my problem. – Name Jan 06 '15 at 20:10

1 Answers1

5

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.

Nsukami _
  • 6,341
  • 2
  • 22
  • 35