unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Problem with TLS when sending emails
@ 2022-05-11 13:28 Alessandro Bertulli
  2022-05-11 13:44 ` Robert Pluim
  2022-05-11 15:34 ` Leo Butler
  0 siblings, 2 replies; 6+ messages in thread
From: Alessandro Bertulli @ 2022-05-11 13:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all.
I was trying to set up my Gmail configuration to send emails from
Emacs. However, I encounter a problem with TLS.

1) I set up a file ~/.authinfo.gpg, where I put

machine imap.gmail.com login alessandro.bertulli96@gmail.com password
-pswd- port 993
machine smtp.gmail.com login alessandro.bertulli96@gmail.com password
-pswd- port 587

Note that "-pswd-" is actually the 16 char long app password generated
by Gmail, required to use external clients.

2) My init file contains

(setq user-full-name "Alessandro Bertulli"
      user-mail-address "alessandro.bertulli96@gmail.com")
(setq smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      smtpmail-stream-type  'ssl
      smtpmail-debug-info t)
;; Configure the function to use for sending mail
(setq message-send-mail-function 'smtpmail-send-it)

I haven't any external package to deal with email (like mu4e, notmuch
etc). With these settings, when I try to compose an email (C-x m), I get
the following error in the *Messages* buffer:

Sending...
Sending via mail...
Decrypting /home/alessandro/.authinfo.gpg...done
gnutls.el: (err=[-15] An unexpected TLS packet was received.) boot:
(:priority NORMAL:%DUMBFW :hostname smtp.gmail.com :loglevel 0
:min-prime-bits nil :trustfiles (/etc/ssl/certs/ca-certificates.crt
/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil
:verify-error nil :callbacks nil)
gnutls-negotiate: GnuTLS error: #<process smtpmail>, -15

What can it be? Is this the right way to send emails? Has any other had
problems with Gmail?
Thank you for your patience,
Alessandro Bertulli


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: Problem with TLS when sending emails
@ 2022-05-11 16:20 Alessandro Bertulli
  2022-05-11 16:28 ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Alessandro Bertulli @ 2022-05-11 16:20 UTC (permalink / raw)
  To: rpluim, Leo.Butler; +Cc: help-gnu-emacs

Thanks Robert! I changed my init code to

(setq smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 465
      smtpmail-stream-type  'ssl
      smtpmail-debug-info t)

And now it works. A couple of fun facts: indicating as
smtpmail-smtp-service the string "smtps" actually doesn't work, because
my system is not able, apparently, to resolve it. So I had to put the
integer port. Moreover, I also had to add a new line to the
~/.authinfo.gpg file. However, now it properly works. Thank you really
much!

For Leo: thanks for your suggestion, but I'm trying to keep my system as
secure as it's reasonably possible. However, I'll investigate your
suggestion about using Gnus.

Thanks to both!



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-11 16:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-11 13:28 Problem with TLS when sending emails Alessandro Bertulli
2022-05-11 13:44 ` Robert Pluim
2022-05-11 15:34 ` Leo Butler
2022-05-11 15:44   ` Robert Pluim
  -- strict thread matches above, loose matches on Subject: below --
2022-05-11 16:20 Alessandro Bertulli
2022-05-11 16:28 ` Robert Pluim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).