all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Can't send mail with smtpmail "any more". (Gmail and other providers)
@ 2020-10-27  3:39 Vladimir Nikishkin
  2020-10-27  4:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 13+ messages in thread
From: Vladimir Nikishkin @ 2020-10-27  3:39 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:

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



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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-10-27  3:39 Can't send mail with smtpmail "any more". (Gmail and other providers) Vladimir Nikishkin
@ 2020-10-27  4:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-27  4:51   ` Vladimir Nikishkin
  0 siblings, 1 reply; 13+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-27  4:19 UTC (permalink / raw)
  To: help-gnu-emacs

Vladimir Nikishkin wrote:

> The symptom is the following:

Did you forget to yank it?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* 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; 13+ 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] 13+ messages in thread

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-10-27  4:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-27  4:51   ` Vladimir Nikishkin
  0 siblings, 0 replies; 13+ messages in thread
From: Vladimir Nikishkin @ 2020-10-27  4:51 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

I have just sent a draft by mistake.

On Tue, 27 Oct 2020 at 12:19, Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Vladimir Nikishkin wrote:
>
> > The symptom is the following:
>
> Did you forget to yank it?
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>


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



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

* Re: 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
       [not found]   ` <CA+A2iZbz7Z_ma2NBCFYq8rvfCiFB4d0X1+w9=0rSeByCeQDr1g@mail.gmail.com>
  2020-11-01 12:34   ` Saša Janiška
  0 siblings, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2020-10-27 15:15 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Vladimir Nikishkin <lockywolf@gmail.com>
> Date: Tue, 27 Oct 2020 12:49:24 +0800
> 
> 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
> ```

This seems to be self-explanatory: Emacs is unable to connect to that
address and that port.  Are you sure there isn't some connectivity
problem on your side?  Like some firewall settings, or maybe actual
connectivity issue?

smtpmail.el has a debug facility, whereby you can set a variable and
get a buffer with the details of the connection session.  If the above
doesn't give a clue, try looking at those details.



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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
       [not found]   ` <CA+A2iZbz7Z_ma2NBCFYq8rvfCiFB4d0X1+w9=0rSeByCeQDr1g@mail.gmail.com>
@ 2020-10-27 15:45     ` Vladimir Nikishkin
  2020-10-27 16:02       ` Robert Pluim
  0 siblings, 1 reply; 13+ messages in thread
From: Vladimir Nikishkin @ 2020-10-27 15:45 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs

I worked around this issue by switching to port 465+ssl/tls

It almost seems like port 587 got blackholed by something.

Debugging facilities did not illuminate the situation, the deadlock happens
before anything is written there.

--
Yours sincerely, Vladimir Nikishkin
(Sent with Google mail mobile.)

Vladimir Nikishkin <lockywolf@gmail.com> 于 2020年10月27日周二 23:43写道:

> I worked around this issue by switching to port 465+ssl/tls
>
> It almost seems like port 587 got blackholed by something.
>
> Debugging facilities did not illuminate the situation, the deadlock
> happens before anything is written there.
>
> --
> Yours sincerely, Vladimir Nikishkin
> (Sent with Google mail mobile.)
>
> Eli Zaretskii <eliz@gnu.org> 于 2020年10月27日周二 23:28写道:
>
>> > From: Vladimir Nikishkin <lockywolf@gmail.com>
>> > Date: Tue, 27 Oct 2020 12:49:24 +0800
>> >
>> > 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
>> > ```
>>
>> This seems to be self-explanatory: Emacs is unable to connect to that
>> address and that port.  Are you sure there isn't some connectivity
>> problem on your side?  Like some firewall settings, or maybe actual
>> connectivity issue?
>>
>> smtpmail.el has a debug facility, whereby you can set a variable and
>> get a buffer with the details of the connection session.  If the above
>> doesn't give a clue, try looking at those details.
>>
>>


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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-10-27 15:45     ` Vladimir Nikishkin
@ 2020-10-27 16:02       ` Robert Pluim
  0 siblings, 0 replies; 13+ messages in thread
From: Robert Pluim @ 2020-10-27 16:02 UTC (permalink / raw)
  To: Vladimir Nikishkin; +Cc: help-gnu-emacs

Vladimir Nikishkin <lockywolf@gmail.com> writes:

> I worked around this issue by switching to port 465+ssl/tls
>

That in itself is a good thing :-)

> It almost seems like port 587 got blackholed by something.

Itʼs not uncommon for ISPs to block outgoing port 25, I guess somebody
decided to do the same for 587

> Debugging facilities did not illuminate the situation, the deadlock happens
> before anything is written there.

Itʼs not a deadlock, itʼs just that whoever is doing the blocking just
drops the packets rather than sending a reset, so Emacs is waiting for
a response that will never come (and eventually TCP will time out).

Robert



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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-10-27 15:15 ` Eli Zaretskii
       [not found]   ` <CA+A2iZbz7Z_ma2NBCFYq8rvfCiFB4d0X1+w9=0rSeByCeQDr1g@mail.gmail.com>
@ 2020-11-01 12:34   ` Saša Janiška
  2020-11-01 13:05     ` Jean Louis
  2020-11-01 15:24     ` Eli Zaretskii
  1 sibling, 2 replies; 13+ messages in thread
From: Saša Janiška @ 2020-11-01 12:34 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 27 Oct 2020 17:15:56 +0200
Eli Zaretskii <eliz@gnu.org> wrote:

> smtpmail.el has a debug facility, whereby you can set a variable and
> get a buffer with the details of the connection session.

What about adding some regular logging facility to smtpmail.el? It is
the main reason why I'm using msmtp instead?

(This email is still sent by Claws until I decide which client to use: Gnus or mu4e.)


Sincerely,
Gour

-- 
Not by merely abstaining from work can one achieve freedom
from reaction, nor by renunciation alone can one attain perfection.





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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-11-01 12:34   ` Saša Janiška
@ 2020-11-01 13:05     ` Jean Louis
  2020-11-01 15:20       ` Vladimir Nikishkin
  2020-11-01 15:24     ` Eli Zaretskii
  1 sibling, 1 reply; 13+ messages in thread
From: Jean Louis @ 2020-11-01 13:05 UTC (permalink / raw)
  To: Saša Janiška; +Cc: help-gnu-emacs

* Saša Janiška <gour@atmarama.com> [2020-11-01 15:35]:
> On Tue, 27 Oct 2020 17:15:56 +0200
> Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > smtpmail.el has a debug facility, whereby you can set a variable and
> > get a buffer with the details of the connection session.
> 
> What about adding some regular logging facility to smtpmail.el? It is
> the main reason why I'm using msmtp instead?
> 
> (This email is still sent by Claws until I decide which client to
> use: Gnus or mu4e.)

M-x rmail is quite good client for email handling in Emacs.

Then there is:

M-x mh-rmail which may have many good power users' options

For me, due to nature of my email handling and having over 50000
Maildir directories inside of ~/Maildir and that none of Emacs clients
is handling Maildirs, I am using mutt email client. That is one of
most efficient for me. And I am launching it inside of Emacs and
editing files with Emacs by using emacsclient

(defun mutt-emacs ()
  "Opens mutt in ansi-term buffer within GNU Emacs"
  (interactive)
  (let* ((default-directory (getenv "HOME")))
    (ansi-term "mutt")))

But my M-x becomes not usable when I am in ansi-term, I would like
that it is usable. 

I made this function to open up mutt in vterm and I still use it. But
that was workaround from time when ansi-term was not handling best
some terminal activities. Bugs have been polished and now ansi-term
works just fine.

(defun mutt-vterm ()
  "Opens mutt in vterm buffer within GNU Emacs"
  (interactive)
  (let* ((default-directory (getenv "HOME"))
	 (buffer-exist (get-buffer "mutt"))
	 (vterm-kill-buffer-on-exit t)
	 (vterm-shell "mutt")
	 (last-key (last-key)))
    (if buffer-exist
	(if (and (not (symbolp last-key))
		 (not (= last-key 8388717)))
	    (vterm "mutt")
	  (if (and (not (string-match (buffer-name (current-buffer)) "mutt"))
		   (y-or-n-p "Buffer `mutt' exists, do you wish to switch?"))
	      (switch-to-buffer "mutt")))
      (vterm "mutt"))))

(global-set-key (kbd "s-m") 'mutt-you-name-it)

For fetching emails I recommend using GNU mailtools and setting up
crontab to regularly fetch emails to local computer.

For sending, I recommend using the MTA on the system if such exists on
your system, for example exim, courier MTA, OpenSMTPD, Postfix and
similar. Those are handling the queues well if you have good
connection to Internet.

msmtp is excellent tool and handles queues of email even if connection
to Internet is sporadic. MTAs need to be configured to handled mail in
queues for longer time and for that reason some emails could be lost
or returned back.

I am using those scripts for msmtp, like list queue and similar. So
the script below is at ~/bin/sendmail and my PATH is ~/bin as well so
Emacs will recognize it as sendmail and dispatch email without any
further settings to msmtp. That is very handy when using it with emacs
-Q when one needs to M-x report-emacs-bug

~/bin/sendmail follows below:

#!/usr/bin/env bash

QUEUEDIR=$HOME/.msmtpqueue

# Set secure permissions on created directories and files
umask 077

# Change to queue directory (create it if necessary)
if [ ! -d "$QUEUEDIR" ]; then
	mkdir -p "$QUEUEDIR" || exit 1
fi
cd "$QUEUEDIR" || exit 1

# Create new unique filenames of the form
# MAILFILE:  ccyy-mm-dd-hh.mm.ss[-x].mail
# MSMTPFILE: ccyy-mm-dd-hh.mm.ss[-x].msmtp
# where x is a consecutive number only appended if you send more than one 
# mail per second.
BASE="`/bin/date +%Y-%m-%d-%H.%M.%S`"
if [ -f "$BASE.mail" -o -f "$BASE.msmtp" ]; then
	TMP="$BASE"
	i=1
	while [ -f "$TMP-$i.mail" -o -f "$TMP-$i.msmtp" ]; do
		i=`expr $i + 1`
	done
	BASE="$BASE-$i"
fi
MAILFILE="$BASE.mail"
MSMTPFILE="$BASE.msmtp"

# Write command line to $MSMTPFILE
echo "$@" > "$MSMTPFILE" || exit 1

# Write the mail to $MAILFILE
cat > "$MAILFILE" || exit 1

# If we are online, run the queue immediately.
# Replace the test with something suitable for your site.
ping -c 1 -w 2 stw1.rcdrun.com > /dev/null 
if [ $? -eq 0 ]; then
	msmtp-runqueue.sh > /dev/null &
fi

exit 0



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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-11-01 13:05     ` Jean Louis
@ 2020-11-01 15:20       ` Vladimir Nikishkin
  0 siblings, 0 replies; 13+ messages in thread
From: Vladimir Nikishkin @ 2020-11-01 15:20 UTC (permalink / raw)
  To: Jean Louis, help-gnu-emacs

mu4e can handle maildirs. Notmuch can also handle maildirs.

Moreover, you can use both on the same maildir that mutt already has, at
the same time, and use any of those as a search engine for mutt.

--
Yours sincerely, Vladimir Nikishkin
(Sent with Google mail mobile.)

Jean Louis <bugs@gnu.support> 于 2020年11月1日周日 21:06写道:

> * Saša Janiška <gour@atmarama.com> [2020-11-01 15:35]:
> > On Tue, 27 Oct 2020 17:15:56 +0200
> > Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > smtpmail.el has a debug facility, whereby you can set a variable and
> > > get a buffer with the details of the connection session.
> >
> > What about adding some regular logging facility to smtpmail.el? It is
> > the main reason why I'm using msmtp instead?
> >
> > (This email is still sent by Claws until I decide which client to
> > use: Gnus or mu4e.)
>
> M-x rmail is quite good client for email handling in Emacs.
>
> Then there is:
>
> M-x mh-rmail which may have many good power users' options
>
> For me, due to nature of my email handling and having over 50000
> Maildir directories inside of ~/Maildir and that none of Emacs clients
> is handling Maildirs, I am using mutt email client. That is one of
> most efficient for me. And I am launching it inside of Emacs and
> editing files with Emacs by using emacsclient
>
> (defun mutt-emacs ()
>   "Opens mutt in ansi-term buffer within GNU Emacs"
>   (interactive)
>   (let* ((default-directory (getenv "HOME")))
>     (ansi-term "mutt")))
>
> But my M-x becomes not usable when I am in ansi-term, I would like
> that it is usable.
>
> I made this function to open up mutt in vterm and I still use it. But
> that was workaround from time when ansi-term was not handling best
> some terminal activities. Bugs have been polished and now ansi-term
> works just fine.
>
> (defun mutt-vterm ()
>   "Opens mutt in vterm buffer within GNU Emacs"
>   (interactive)
>   (let* ((default-directory (getenv "HOME"))
>          (buffer-exist (get-buffer "mutt"))
>          (vterm-kill-buffer-on-exit t)
>          (vterm-shell "mutt")
>          (last-key (last-key)))
>     (if buffer-exist
>         (if (and (not (symbolp last-key))
>                  (not (= last-key 8388717)))
>             (vterm "mutt")
>           (if (and (not (string-match (buffer-name (current-buffer))
> "mutt"))
>                    (y-or-n-p "Buffer `mutt' exists, do you wish to
> switch?"))
>               (switch-to-buffer "mutt")))
>       (vterm "mutt"))))
>
> (global-set-key (kbd "s-m") 'mutt-you-name-it)
>
> For fetching emails I recommend using GNU mailtools and setting up
> crontab to regularly fetch emails to local computer.
>
> For sending, I recommend using the MTA on the system if such exists on
> your system, for example exim, courier MTA, OpenSMTPD, Postfix and
> similar. Those are handling the queues well if you have good
> connection to Internet.
>
> msmtp is excellent tool and handles queues of email even if connection
> to Internet is sporadic. MTAs need to be configured to handled mail in
> queues for longer time and for that reason some emails could be lost
> or returned back.
>
> I am using those scripts for msmtp, like list queue and similar. So
> the script below is at ~/bin/sendmail and my PATH is ~/bin as well so
> Emacs will recognize it as sendmail and dispatch email without any
> further settings to msmtp. That is very handy when using it with emacs
> -Q when one needs to M-x report-emacs-bug
>
> ~/bin/sendmail follows below:
>
> #!/usr/bin/env bash
>
> QUEUEDIR=$HOME/.msmtpqueue
>
> # Set secure permissions on created directories and files
> umask 077
>
> # Change to queue directory (create it if necessary)
> if [ ! -d "$QUEUEDIR" ]; then
>         mkdir -p "$QUEUEDIR" || exit 1
> fi
> cd "$QUEUEDIR" || exit 1
>
> # Create new unique filenames of the form
> # MAILFILE:  ccyy-mm-dd-hh.mm.ss[-x].mail
> # MSMTPFILE: ccyy-mm-dd-hh.mm.ss[-x].msmtp
> # where x is a consecutive number only appended if you send more than one
> # mail per second.
> BASE="`/bin/date +%Y-%m-%d-%H.%M.%S`"
> if [ -f "$BASE.mail" -o -f "$BASE.msmtp" ]; then
>         TMP="$BASE"
>         i=1
>         while [ -f "$TMP-$i.mail" -o -f "$TMP-$i.msmtp" ]; do
>                 i=`expr $i + 1`
>         done
>         BASE="$BASE-$i"
> fi
> MAILFILE="$BASE.mail"
> MSMTPFILE="$BASE.msmtp"
>
> # Write command line to $MSMTPFILE
> echo "$@" > "$MSMTPFILE" || exit 1
>
> # Write the mail to $MAILFILE
> cat > "$MAILFILE" || exit 1
>
> # If we are online, run the queue immediately.
> # Replace the test with something suitable for your site.
> ping -c 1 -w 2 stw1.rcdrun.com > /dev/null
> if [ $? -eq 0 ]; then
>         msmtp-runqueue.sh > /dev/null &
> fi
>
> exit 0
>
>


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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-11-01 12:34   ` Saša Janiška
  2020-11-01 13:05     ` Jean Louis
@ 2020-11-01 15:24     ` Eli Zaretskii
  2020-11-01 19:05       ` Saša Janiška
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2020-11-01 15:24 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Saša Janiška <gour@atmarama.com>
> Date: Sun, 1 Nov 2020 13:34:43 +0100
> 
> On Tue, 27 Oct 2020 17:15:56 +0200
> Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > smtpmail.el has a debug facility, whereby you can set a variable and
> > get a buffer with the details of the connection session.
> 
> What about adding some regular logging facility to smtpmail.el?

How would that be different from what smtpmail already has?



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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-11-01 15:24     ` Eli Zaretskii
@ 2020-11-01 19:05       ` Saša Janiška
  2020-11-01 19:39         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Saša Janiška @ 2020-11-01 19:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, 01 Nov 2020 17:24:41 +0200
Eli Zaretskii <eliz@gnu.org> wrote:

> How would that be different from what smtpmail already has?

When I was playing with smtpmail I wanted to check whether the email was 
delivered, but have a feeling that there is only verbose debug output which is 
more than I usually need just to check if email went through.


Sincerely,
Gour

-- 
Bewildered by the modes of material nature, the ignorant fully
engage themselves in material activities and become attached. But
the wise should not unsettle them, although these duties are inferior
due to the performers' lack of knowledge.





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

* Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
  2020-11-01 19:05       ` Saša Janiška
@ 2020-11-01 19:39         ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2020-11-01 19:39 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Saša Janiška <gour@atmarama.com>
> Date: Sun, 1 Nov 2020 20:05:46 +0100
> 
> On Sun, 01 Nov 2020 17:24:41 +0200
> Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > How would that be different from what smtpmail already has?
> 
> When I was playing with smtpmail I wanted to check whether the email was 
> delivered

This is announced in the echo-area by default.  No need for any logs.



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

end of thread, other threads:[~2020-11-01 19:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27  3:39 Can't send mail with smtpmail "any more". (Gmail and other providers) Vladimir Nikishkin
2020-10-27  4:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-27  4:51   ` Vladimir Nikishkin
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27  4:49 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 15:20       ` Vladimir Nikishkin
2020-11-01 15:24     ` Eli Zaretskii
2020-11-01 19:05       ` Saša Janiška
2020-11-01 19:39         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.