unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Can't send mail with smtpmail "any more". (Gmail and other providers)
@ 2020-10-27  4:49 Vladimir Nikishkin
  2020-10-27 15:15 ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Vladimir Nikishkin @ 2020-10-27  4:49 UTC (permalink / raw)
  To: help-gnu-emacs

`Hello, everyone.

I had a setup for sending mail with Emacs' smtpmail:

```
(setq send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-default-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 587)
(setq smtpmail-stream-type 'starttls)
(setq smtpmail-starttls-credentials '("smtp.gmail.com" 587))
(setq smtpmail-smtp-user "lockywolf")
(setq smtpmail-auth-credentials '("smtp.gmail.com" 587))
(require 'starttls)
(setq starttls-use-gnutls t)
(setq smtpmail-debug-info t)
(setq smtpmail-debug-verb t)
(require 'smtpmail)
```

This used to work until today.

Today, this setup stopped working for some reason. Initially I blamed
it on GMail, but it seems that other providers don't work tool.

The symptom is the following:

I open message mode by M-x message-mail RET , type in the from: and
to: as the same, my own, address, and send it with C-c C-c.

The system displays the message:
```
Sending via mail...
```
and freezes. This freeze is "quitable" with C-g.
If I set "toggle-debug-on-quit", the stack trace is the following:

```
Debugger entered--Lisp error: (quit)
  make-network-process(:name "smtpmail" :buffer #<buffer *trace of
SMTP session to smtp.gmail.com*> :host "smtp.gmail.com" :service 587)
  network-stream-open-starttls("smtpmail" #<buffer *trace of SMTP
session to smtp.gmail.com*> "smtp.gmail.com" 587 (:type starttls
:return-list t :warn-unless-encrypted nil :capability-command "EHLO
delllaptop.lockywolf.net\15\n" :end-of-command "^[0-9]+ .*\15\n"
:success "^2.*\n" :always-query-capabilities t :starttls-function
#f(compiled-function (capabilities) #<bytecode 0x6fb3e5>)
:client-certificate t :use-starttls-if-possible t))
  open-network-stream("smtpmail" #<buffer *trace of SMTP session to
smtp.gmail.com*> "smtp.gmail.com" 587 :type starttls :return-list t
:warn-unless-encrypted nil :capability-command "EHLO
delllaptop.lockywolf.net\15\n" :end-of-command "^[0-9]+ .*\15\n"
:success "^2.*\n" :always-query-capabilities t :starttls-function
#f(compiled-function (capabilities) #<bytecode 0x6fb3e5>)
:client-certificate t :use-starttls-if-possible t)
  smtpmail-via-smtp(("<redacted>") #<buffer  smtpmail temp>)
  smtpmail-send-it()
  message-use-send-mail-function()
  message--default-send-mail-function()
  message-multi-smtp-send-mail()
  message--send-mail-maybe-partially()
  message-send-mail(nil)
  message-send-via-mail(nil)
  message-send(nil)
  message-send-and-exit(nil)
  funcall-interactively(message-send-and-exit nil)
  call-interactively(message-send-and-exit nil nil)
  command-execute(message-send-and-exit)
```
I have redacted out the email address.

Connecting to the process with gdb and asking for a stack trace produces:

```
lockywolf@delllaptop:~$ gdb -p $(pgrep emacs)
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-slackware-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 13559
[New LWP 13560]
[New LWP 13561]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
--Type <RET> for more, q to quit, c to continue without paging--c
0x00007f268a51207e in pselect () from /lib64/libc.so.6
(gdb) thread apply all bt

Thread 3 (Thread 0x7f268380f700 (LWP 13561)):
#0  0x00007f268a50fe9f in poll () at /lib64/libc.so.6
#1  0x00007f268c4f4bce in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007f268c4f4f33 in g_main_loop_run () at /usr/lib64/libglib-2.0.so.0
#3  0x00007f268c73b936 in  () at /usr/lib64/libgio-2.0.so.0
#4  0x00007f268c51c61d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007f268a6e406b in start_thread () at /lib64/libpthread.so.0
#6  0x00007f268a51b72f in clone () at /lib64/libc.so.6

Thread 2 (Thread 0x7f2688975700 (LWP 13560)):
#0  0x00007f268a50fe9f in poll () at /lib64/libc.so.6
#1  0x00007f268c4f4bce in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007f268c4f4cef in g_main_context_iteration () at
/usr/lib64/libglib-2.0.so.0
#3  0x00007f268c4f4d41 in  () at /usr/lib64/libglib-2.0.so.0
#4  0x00007f268c51c61d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007f268a6e406b in start_thread () at /lib64/libpthread.so.0
#6  0x00007f268a51b72f in clone () at /lib64/libc.so.6
--Type <RET> for more, q to quit, c to continue without paging--c

Thread 1 (Thread 0x7f2689455640 (LWP 13559)):
#0  0x00007f268a51207e in pselect () at /lib64/libc.so.6
#1  0x00000000005aef85 in  ()
#2  0x00000000005af9d2 in  ()
#3  0x0000000000572883 in  ()
#4  0x00000000005a6bb8 in  ()
#5  0x00000000005727d7 in  ()
#6  0x00000000005a6bb8 in  ()
#7  0x00000000005727d7 in  ()
#8  0x00000000005a6bb8 in  ()
#9  0x00000000005727d7 in  ()
#10 0x00000000005a6bb8 in  ()
#11 0x00000000005727d7 in  ()
#12 0x00000000005a6bb8 in  ()
#13 0x00000000005727d7 in  ()
#14 0x00000000005a6bb8 in  ()
#15 0x00000000005727d7 in  ()
#16 0x00000000005a6bb8 in  ()
#17 0x00000000005727d7 in  ()
#18 0x00000000005a6bb8 in  ()
#19 0x00000000005727d7 in  ()
#20 0x00000000005a6bb8 in  ()
#21 0x00000000005727d7 in  ()
#22 0x00000000005a6bb8 in  ()
#23 0x00000000005727d7 in  ()
#24 0x00000000005a6bb8 in  ()
#25 0x00000000005727d7 in  ()
#26 0x00000000005a6bb8 in  ()
#27 0x00000000005727d7 in  ()
#28 0x000000000056f2e4 in  ()
#29 0x0000000000572883 in  ()
#30 0x0000000000570590 in  ()
#31 0x0000000000572883 in  ()
#32 0x00000000005a6bb8 in  ()
#33 0x00000000005727d7 in  ()
#34 0x000000000057292a in  ()
#35 0x000000000050c45d in  ()
#36 0x0000000000571bef in  ()
#37 0x00000000004fd648 in  ()
#38 0x0000000000571b53 in  ()
#39 0x00000000004fd5d6 in  ()
#40 0x0000000000500aef in  ()
#41 0x0000000000500e0d in  ()
#42 0x0000000000426642 in  ()
#43 0x00007f268a428e5b in __libc_start_main () at /lib64/libc.so.6
#44 0x0000000000426dda in  ()
(gdb)
```

Sometimes (unpredictably), the connection times out and produces the
following message:

```
network-stream-open-starttls: make client process failed: Network is
unreachable, :name, smtpmail, :buffer, *trace of SMTP session to
smtp.gmail.com*, :host, smtp.gmail.com, :service, 587
```

Trying to make an MWE,
 1. I launched emacs -Q
 2. M-x message-mail RET
 3. Typed in :to and :from
 4. M-x toggle-debug-on-quit RET
 5. C-c C-c
 6. smtp RET
 7. smtp.gmail.com RET
And received an identical freeze.
After:
 8. C-g (once) -> nothing happens (no stack trace)
 9. C-g (second time) -> a message appears:
`Port number to use when contacting smtp.gmail.com?`
 10. 587 -> freeze
 11. C-g -> `smtpmail-query-smtp-server: Couldn’t contact an SMTP server`

If I connect to emacs with gdb after step 7:

```
(gdb) thread apply all bt

Thread 3 (Thread 0x7fa7558b2700 (LWP 9546)):
#0  0x00007fa75858be9f in poll () at /lib64/libc.so.6
#1  0x00007fa75a570bce in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007fa75a570f33 in g_main_loop_run () at /usr/lib64/libglib-2.0.so.0
#3  0x00007fa75a7b7936 in  () at /usr/lib64/libgio-2.0.so.0
#4  0x00007fa75a59861d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007fa75876006b in start_thread () at /lib64/libpthread.so.0
#6  0x00007fa75859772f in clone () at /lib64/libc.so.6

Thread 2 (Thread 0x7fa7569f1700 (LWP 9545)):
#0  0x00007fa75858be9f in poll () at /lib64/libc.so.6
#1  0x00007fa75a570bce in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007fa75a570cef in g_main_context_iteration () at
/usr/lib64/libglib-2.0.so.0
#3  0x00007fa75a570d41 in  () at /usr/lib64/libglib-2.0.so.0
#4  0x00007fa75a59861d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007fa75876006b in start_thread () at /lib64/libpthread.so.0
--Type <RET> for more, q to quit, c to continue without paging--c
#6  0x00007fa75859772f in clone () at /lib64/libc.so.6

Thread 1 (Thread 0x7fa7574d1640 (LWP 9544)):
#0  0x00007fa75858e07e in pselect () at /lib64/libc.so.6
#1  0x00000000005aef85 in  ()
#2  0x00000000005af9d2 in  ()
#3  0x0000000000572883 in  ()
#4  0x00000000005a6bb8 in  ()
#5  0x00000000005727d7 in  ()
#6  0x00000000005a6bb8 in  ()
#7  0x00000000005727d7 in  ()
#8  0x00000000005a6bb8 in  ()
#9  0x00000000005727d7 in  ()
#10 0x00000000005a6bb8 in  ()
#11 0x00000000005727d7 in  ()
#12 0x00000000005a6bb8 in  ()
#13 0x00000000005727d7 in  ()
#14 0x00000000005a6bb8 in  ()
#15 0x00000000005727d7 in  ()
#16 0x00000000005a6bb8 in  ()
#17 0x00000000005727d7 in  ()
#18 0x00000000005a6bb8 in  ()
#19 0x00000000005727d7 in  ()
#20 0x00000000005a6bb8 in  ()
#21 0x00000000005727d7 in  ()
#22 0x00000000005a6bb8 in  ()
#23 0x00000000005727d7 in  ()
#24 0x00000000005a6bb8 in  ()
#25 0x00000000005727d7 in  ()
#26 0x00000000005a6bb8 in  ()
#27 0x00000000005727d7 in  ()
#28 0x000000000056f2e4 in  ()
#29 0x0000000000572883 in  ()
#30 0x0000000000570590 in  ()
#31 0x0000000000572883 in  ()
#32 0x00000000005a6bb8 in  ()
#33 0x00000000005727d7 in  ()
#34 0x000000000057292a in  ()
#35 0x000000000050c45d in  ()
#36 0x0000000000571bef in  ()
#37 0x00000000004fd648 in  ()
#38 0x0000000000571b53 in  ()
#39 0x00000000004fd5d6 in  ()
#40 0x0000000000500aef in  ()
#41 0x0000000000500e0d in  ()
#42 0x0000000000426642 in  ()
#43 0x00007fa7584a4e5b in __libc_start_main () at /lib64/libc.so.6
#44 0x0000000000426dda in  ()
(gdb)
```
(require 'starttls) doesn't seem to change anything, except give a
warning about starttls being obsolete.


System:
Emacs 27.1
Kernel: 5.4.72 #1 SMP Sat Oct 17 14:26:06 CDT 2020 x86_64 Intel(R)
Core(TM) i5-2520M CPU @ 2.50GHz GenuineIntel GNU/Linux
glib2-2.66.2
glibc-2.30
gtk+3-3.24.23

What can I do else to make smtp work as yesterday, or at least debuggable?

--
Yours sincerely, Vladimir Nikishkin
(Sent from GMail web interface.)



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

end of thread, other threads:[~2020-11-02 12:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27  4:49 Can't send mail with smtpmail "any more". (Gmail and other providers) Vladimir Nikishkin
2020-10-27 15:15 ` Eli Zaretskii
     [not found]   ` <CA+A2iZbz7Z_ma2NBCFYq8rvfCiFB4d0X1+w9=0rSeByCeQDr1g@mail.gmail.com>
2020-10-27 15:45     ` Vladimir Nikishkin
2020-10-27 16:02       ` Robert Pluim
2020-11-01 12:34   ` Saša Janiška
2020-11-01 13:05     ` Jean Louis
2020-11-01 13:30       ` Can't send mail with smtpmail "any more" " Saša Janiška
2020-11-01 15:30         ` Jean Louis
2020-11-01 19:03           ` Saša Janiška
2020-11-01 21:19             ` Jean Louis
2020-11-02 12:27               ` Saša Janiška
2020-11-01 15:20       ` Can't send mail with smtpmail "any more". " Vladimir Nikishkin
2020-11-02  9:36         ` notmuch or mu for Emacs - " Jean Louis
2020-11-01 15:24     ` Eli Zaretskii
2020-11-01 19:05       ` Saša Janiška
2020-11-01 19:39         ` Eli Zaretskii

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).