106 views
Skip to first unread message

Eduardo Mercovich

unread,
Jun 16, 2017, 9:58:33 AM6/16/17
to mu-discuss
Hi everyone.

I just read "Handling Email with Emacs" (30/06/2016) from
Martinralbrecht
(https://martinralbrecht.wordpress.com/2016/05/30/handling-email-with-emacs/)
and among some gems I found particularly interesting the use of
OpenSMTPD to send mail asynchronically. This is quite interesting
since it wouldn't block emacs when sending mail.

I know it may sound quite simple to many of you, but to change the
default exim in my debian box sounds almost dangerous to me, so
before going into hacking mode, I'd like to know if someone is
using (or know someone using) OpenSMTPD and in that case, what is
your experience...

Thanks a lot for sharing. :)

Best...


--
Eduardo Mercovich

Donde se cruzan tus talentos
con las necesidades del mundo,
ahí está tu vocación.
(Anónimo)

Ævar Arnfjörð Bjarmason

unread,
Jun 16, 2017, 3:13:25 PM6/16/17
to mu-di...@googlegroups.com
On Fri, Jun 16, 2017 at 3:58 PM, Eduardo Mercovich
<eduardo....@gmail.com> wrote:
> I just read "Handling Email with Emacs" (30/06/2016) from Martinralbrecht
> (https://martinralbrecht.wordpress.com/2016/05/30/handling-email-with-emacs/)
> and among some gems I found particularly interesting the use of OpenSMTPD to
> send mail asynchronically. This is quite interesting since it wouldn't block
> emacs when sending mail.
> I know it may sound quite simple to many of you, but to change the default
> exim in my debian box sounds almost dangerous to me, so before going into
> hacking mode, I'd like to know if someone is using (or know someone using)
> OpenSMTPD and in that case, what is your experience...
>
> Thanks a lot for sharing. :)

I use exim4 on Debian to send E-Mail async. The author of that
blogpost is just asserting that exim is hard to configure without
further explanation, I found it trivial to configure, here's how to do
it with GMail as a smarthost: https://wiki.debian.org/GmailAndExim4

It's literally a click-through dialog and editing just one config file
with your username, password & host afterwards to make the thing work.
I can't imagine what he's talking about with hard to configure.

I'm sure you can make OpenSMTPD work for you too for this purpose, but
there's no need to replace Exim on Debian just to get a working smtpd.

> Eduardo Mercovich
> Donde se cruzan tus talentos con las necesidades del mundo, ahí está tu
> vocación. (Anónimo)
> --
> You received this message because you are subscribed to the Google Groups
> "mu-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mu-discuss+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Vladimir Sedach

unread,
Jun 16, 2017, 10:40:33 PM6/16/17
to mu-di...@googlegroups.com
IMO it is even easier to set up smtpmail.el to send email
asynchronously by running it in a separate Emacs batch process. Check
out my configuration: https://github.com/vsedach/emacs.d

Mail gets queued and then I run:

emacs -Q --batch -l /home/vas/.emacs.d/extras/my-smtp-setup.el -f
smtpmail-send-queued-mail

when I have Internet access. You can also set up a hook to run the
process. I like to run it from the shell to see the SMTP debug
messages.

I think it would be cool to do a similar thing on the IMAP end by using
nnimap.el from Gnus to replace OfflineIMAP/mbsync, but that would be a
big new project.

Vladimir

Eduardo Mercovich

unread,
Jun 18, 2017, 6:08:01 PM6/18/17
to mu-di...@googlegroups.com
Hi Ævar.

>> [...] among some gems I found particularly interesting the use
>> of OpenSMTPD to send mail asynchronically. [...] to change the
>> default exim in my debian box sounds almost dangerous to me, so
>> before going into hacking mode, I'd like to know if someone is
>> using (or know someone using) OpenSMTPD and in that case, what
>> is your experience...

> I use exim4 on Debian to send E-Mail async [...]

I don't send big attachments as a norm, but even a couple words in
a mail require some connection and handshaking time, and it
bothers me a lot to wait with emacs apparently frozen... So in
this context, async sending means for me to press C-c C-c and to
continue working immediately in the emacsverse while the mail is
being sent in the background.

So, just to be sure, when you say that exim sends your mail async
it means that you press C-c C-c when your mail is done and you
don't have to wait for the mail to go out to keep doing things? If
it's so, any explanation would be very much welcome... :)


--

Eduardo Mercovich

unread,
Jun 18, 2017, 6:14:55 PM6/18/17
to mu-di...@googlegroups.com
Hi Vladimir.

> IMO it is even easier to set up smtpmail.el to send email
> asynchronously [...] Mail gets queued and then I run:
> emacs -Q --batch -l /home/vas/.emacs.d/extras/my-smtp-setup.el
> -f smtpmail-send-queued-mail
> [...]

While it's very interesting, I believe yours is a different use
case that what I'm searching...

This use case was just explained in the previous mail to Ævar: I'd
like to send mail (as usual) and have emacs responding immediately
back.
Does it make sense to use your solution for every mail? Because I
feel (not being a programmer) that it's more geared towards hours
of offline work and then bacth sending.

Vladimir Sedach

unread,
Jun 19, 2017, 6:08:11 AM6/19/17
to mu-di...@googlegroups.com
> This use case was just explained in the previous mail to Ævar: I'd
> like to send mail (as usual) and have emacs responding immediately
> back.

Yes, that is what running smptmail.el in a separate (second) Emacs
process in batch mode does.

Eduardo Mercovich

unread,
Jun 19, 2017, 8:20:40 AM6/19/17
to mu-di...@googlegroups.com
Hi Vladimir.

>> [...] I'd like to send mail (as usual) and have emacs
>> responding immediately back.

> Yes, that is what running smptmail.el in a separate (second)
> Emacs process in batch mode does.

Perfect, I will investigate that then as soon as I deliver my
current project.

Thanks a lot... :)

Ævar Arnfjörð Bjarmason

unread,
Jun 19, 2017, 3:18:00 PM6/19/17
to mu-di...@googlegroups.com
On Mon, Jun 19, 2017 at 12:07 AM, Eduardo Mercovich
<eduardo....@gmail.com> wrote:
> Hi Ævar.
>
>>> [...] among some gems I found particularly interesting the use of
>>> OpenSMTPD to send mail asynchronically. [...] to change the default exim in
>>> my debian box sounds almost dangerous to me, so before going into hacking
>>> mode, I'd like to know if someone is using (or know someone using) OpenSMTPD
>>> and in that case, what is your experience...
>
>
>> I use exim4 on Debian to send E-Mail async [...]
>
>
> I don't send big attachments as a norm, but even a couple words in a mail
> require some connection and handshaking time, and it bothers me a lot to
> wait with emacs apparently frozen... So in this context, async sending means
> for me to press C-c C-c and to continue working immediately in the
> emacsverse while the mail is being sent in the background.
> So, just to be sure, when you say that exim sends your mail async it means
> that you press C-c C-c when your mail is done and you don't have to wait for
> the mail to go out to keep doing things? If it's so, any explanation would
> be very much welcome... :)

It does two things:

1) You're always, from Emacs's perspective, just sending a mail to
localhost, so there's none of the remote handshaking etc. So you wait
less. Using any smtpd-like solution, including smtpmail.el or exim
does that.

2) Your mu4e doesn't need to deal with any of the special cases where
the send function fails, that's outsourced to the smtpd, e.g. when you
don't have a network connection.

Eduardo Mercovich

unread,
Jun 21, 2017, 10:23:41 AM6/21/17
to mu-di...@googlegroups.com
Hello Ævar.

>>> I use exim4 on Debian to send E-Mail async [...]

>> [...] in this context, async sending means for me to press C-c
>> C-c and to continue working immediately in the emacsverse
>> while the mail is being sent in the background. [...]

> It does two things: 1) You're always, from Emacs's perspective,
> just sending a mail to localhost, so there's none of the remote
> handshaking etc. So you wait less. Using any smtpd-like
> solution, including smtpmail.el or exim does that.

Ah, thank you very much, now I'm starting to undestand. :)

> 2) Your mu4e doesn't need to deal with any of the special cases
> where the send function fails, that's outsourced to the smtpd,
> e.g. when you don't have a network connection.

Beautiful.

Your reply made me start reading about exim4, MTAs and MDAs. While
real understanding is a long reading-tinkering distance from
now/here yet, I grok the idea that exim is the one who does the
real job of sending those mails.

What I still didn't found (surely I'm using the wrong keywords) is
how do we chain mu4e with exim.

Right now, the (hopefully) relevant config lines I have are:

--8<---------------cut here---------------start------------->8---
send-mail-function 'sendmail-send-it
message-send-mail-function 'message-send-mail-with-sendmail
sendmail-program "/usr/bin/msmtp"
--8<---------------cut here---------------end--------------->8---

Maybe it is the <sendmail-program> line that should point to
"/usr/sbin/exim"? (a search for [mu4e "sendmail-program" exim]
gave me nothing, or nothing I could understand at least). ;)
Not counting the exim specific configuration (smarthost without
local delivery), are other changes needed?

Thanks a lot for sharing... :D

Henrik Frisk

unread,
Jun 21, 2017, 10:45:38 AM6/21/17
to mu-di...@googlegroups.com
Om very curious about this too!

/Henrik 

Ævar Arnfjörð Bjarmason

unread,
Jun 21, 2017, 1:28:42 PM6/21/17
to mu-di...@googlegroups.com

On Wed, Jun 21 2017, Eduardo Mercovich jotted:
The only things I set different than the default are:

message-send-mail-function 'message-send-mail-with-sendmail
message-sendmail-envelope-from 'header

All the rest are the defaults, my sendmail-program is
/usr/sbin/sendmail, send-mail-function is
message-send-mail-with-sendmail (although it seems this changes based on
the buffer, that's in my .emacs, here in my mu4e-compose it's
sendmail-query-once).

You should be able to test sending mail with e.g.:

echo hello there | /usr/sbin/sendmail -f y...@example.com y...@example.com

Then just tail /var/log/exim4/mainlog

http://bradthemad.org/tech/notes/exim_cheatsheet.php is a good resource
for getting started with the exim commands.

My .emacs, exim config etc. are on github, here's the relevant .emacs
part: https://github.com/avar/dotemacs/blob/master/.emacs#L515

Note a lot of that commentary is probably out of date.

This is my initial exim setup originally just for my work E-Mail:
https://github.com/avar/laptop-etc/commit/9cfc14423e83c275f15c2b17bb0a3e28927d0c46

Now I also use it for my own (this) Gmail, that setup is very much a
WIP, but here's the Exim part for that:
https://github.com/avar/laptop-etc/commit/9758ce066dffb7addaeb57f58de1282d76226aac

Eduardo Mercovich

unread,
Jul 4, 2017, 10:35:08 PM7/4/17
to mu-di...@googlegroups.com
Dear Ævar.

Sorry the silence, I'm in the middle of delivering days...

[...]

>> Your reply made me start reading about exim4, MTAs and MDAs.
>> While real understanding is a long reading-tinkering distance
>> from now/here yet, I grok the idea that exim is the one who
>> does the real job of sending those mails.

>> What I still didn't found (surely I'm using the wrong keywords)
>> is how do we chain mu4e with exim.

>> Right now, the (hopefully) relevant config lines I have are:
>> --8<---------------cut
>> here---------------start------------->8---
>> send-mail-function 'sendmail-send-it
>> message-send-mail-function 'message-send-mail-with-sendmail
>> sendmail-program "/usr/bin/msmtp"
>> --8<---------------cut
>> here---------------end--------------->8---

>> Maybe it is the <sendmail-program> line that should point to
>> "/usr/sbin/exim"? (a search for [mu4e "sendmail-program" exim]
>> gave me nothing, or nothing I could understand at least). ;)
>> Not counting the exim specific configuration (smarthost without
>> local delivery), are other changes needed?

> The only things I set different than the default are:
> message-send-mail-function 'message-send-mail-with-sendmail
> message-sendmail-envelope-from 'header

I have both exactly the equal to yours.

> All the rest are the defaults, my sendmail-program is
> /usr/sbin/sendmail, send-mail-function is
> message-send-mail-with-sendmail (although it seems this changes
> based on the buffer, that's in my .emacs, here in my
> mu4e-compose it's sendmail-query-once).

Ah, maybe here is the difference... In my config file there is:

send-mail-function 'sendmail-send-it

> You should be able to test sending mail with e.g.:
> echo hello there | /usr/sbin/sendmail -f y...@example.com
> y...@example.com
> Then just tail /var/log/exim4/mainlog

Thanks to https://wiki.debian.org/GmailAndExim4, it seems to be
working.

I must check it more since I have a few accounts and right now, it
seems to be sent always from the 1st one...

> http://bradthemad.org/tech/notes/exim_cheatsheet.php is a good
> resource
> for getting started with the exim commands.

> My .emacs, exim config etc. are on github [...]

Thanks, I will study them.
After these crazy days, around next week, I will report back.

Again, thanks a lot. :D

Best...

Ævar Arnfjörð Bjarmason

unread,
Jul 5, 2017, 7:30:18 AM7/5/17
to mu-di...@googlegroups.com

On Wed, Jul 05 2017, Eduardo Mercovich jotted:
You need to hack Debian's own configuration to make it use multiple
smarthosts. I've done that myself, here's me adding the default config:

https://github.com/avar/laptop-etc/commit/70dd3463362e205549362cd9354aac85ee9cd93f

And a commit that adds a new exim4/smarthosts file that routes to
different smarthosts based on the sender address:

https://github.com/avar/laptop-etc/commit/9758ce066dffb7addaeb57f58de1282d76226aac

I just use this with two fixed from addresses, but as you can see from
my change in exim4/conf.d/router/200_exim4-config_primary you can make
this route based on any criteria.

Thorsten Grothe

unread,
Jul 18, 2017, 12:44:49 PM7/18/17
to mu-discuss
Hi,

I read this article too but opensmtpd ist too complicated for me. I got another simple solution with msmtp.
The msmtp package offers a msmtp-enqueue and msmtp-runqueue script. See here:

Archlinux msmtp runqueue

This way you have absolutely no delay sending mails even with big attachments. One could run msmtp-runqueue with  cron oder systemd
every 2 minutes or so. I tested it and it works pretty well. My idea would be to write a script. It should check if we are online and if so run mstmp-runqueue.
Anyone here who knows how to write such a script?

What do you think?

Regards
Thorsten

Thorsten Grothe

unread,
Jul 18, 2017, 2:18:46 PM7/18/17
to mu-di...@googlegroups.com

I’m answering myself here…

* Thorsten Grothe: 18.07.2017 (16:44):

this tiny script seems to work. It checks if we are online and if
~/.msmtpqueue is not empty. If both conditions are true it runs
msmtp-runqueue.sh if not the script stops to run. No clue if this is
good but it seems to work and is much simpler than a mailserver…

#################################
#!/bin/bash
FILE=""
DIR="/home/manjothor/.msmtpqueue"

# Check if we are online AND check if /home/manjothor/.msmtpqueue is not empty
# if yes for both conditions run run_msmtp_runqueue.sh
# if not exit script

if ping -c 1 google.com >> /dev/null 2>&1 && [ "$(ls -A $DIR)" ]; then
sh msmtp-runqueue.sh
else
echo "Entweder sind wir online, oder wir haben keine Mails zu versenden"
exit
fi
##################################

Regards

Thorsten Grothe

Eduardo Mercovich

unread,
Jul 30, 2017, 5:27:54 PM7/30/17
to mu-di...@googlegroups.com
Hi Ævar.

>> Sorry the silence, I'm in the middle of delivering days...

And just delivered, so I'm back with this exploration. :)

[...]

> You need to hack Debian's own configuration to make it use
> multiple
> smarthosts. I've done that myself, here's me adding the default
> config:
> https://github.com/avar/laptop-etc/commit/70dd3463362e205549362cd9354aac85ee9cd93f

[...]

>>> My .emacs, exim config etc. are on github [...]

>> Thanks, I will study them. After these crazy days, around next
>> week, I will report back.

I'm starting with this, at the same time that will explore the
other option (msmtpqueue) that Thorsten opened.

Is anyone interested into writing this on a shared document about
the delivering methods available?
I started to do so before, but we didn't made a lot and after
that, titanpad closed. :(

But if someone more technically knowlergeable than me is
interested (I work on UX) I can gladly help in making the options
easy to understand and follow for newcomers.

Eduardo Mercovich

unread,
Jul 30, 2017, 5:50:24 PM7/30/17
to mu-di...@googlegroups.com
Hi Thorsten.

>> I just read "Handling Email with Emacs" (30/06/2016) from
>> Martinralbrecht
>> (https://martinralbrecht.wordpress.com/2016/05/30/handling-email-with-emacs/
>> ) and among some gems I found particularly interesting the use
>> of OpenSMTPD to send mail asynchronically. This is quite
>> interesting since it wouldn't block emacs when sending mail.

> I read this article too but opensmtpd ist too complicated for
> me.

It seems many of us are interested in that feature, and find
opensmtp and exim config slightly difficult... ;)

> I got another simple solution with msmtp. The msmtp package
> offers a msmtp-enqueue and msmtp-runqueue script. See here:
> Archlinux msmtp runqueue
> (https://wiki.archlinux.org/index.php/msmtp#Using_msmtp_offline)

Very interesting...

> This way you have absolutely no delay sending mails even with
> big attachments. One could run msmtp-runqueue with cron oder
> systemd every 2 minutes or so. I tested it and it works pretty
> well.

Sorry the (maybe obvious) question: if you use msmtp, may I asume
that they share configuration?

If so, there is almost no change in config needed except change
"sendmail-program "/usr/bin/msmtp""
to
"sendmail-program "/usr/bin/msmtp-enqueue""

And then run msmtp-runqueue when we want the mail to be sent.

> My idea would be to write a script. It should check if we are
> online and if so run mstmp-runqueue. Anyone here who knows how
> to write such a script?
> What do you think?

Beautiful.
Let's continue in your next mail... ;)

Eduardo Mercovich

unread,
Jul 30, 2017, 9:59:41 PM7/30/17
to mu-di...@googlegroups.com
Hi Thorsten.

> this tiny script seems to work. It checks if we are online and
> if
> ~/.msmtpqueue is not empty. If both conditions are true it runs
> msmtp-runqueue.sh if not the script stops to run. No clue if
> this is
> good but it seems to work and is much simpler than a mailserver…
> #################################
> #!/bin/bash
> FILE=""
> DIR="/home/manjothor/.msmtpqueue"
>
> # Check if we are online AND check if
> /home/manjothor/.msmtpqueue is not empty
> # if yes for both conditions run run_msmtp_runqueue.sh
> # if not exit script
>
> if ping -c 1 google.com >> /dev/null 2>&1 && [ "$(ls -A $DIR)"
> ]; then
> sh msmtp-runqueue.sh
> else
> echo "Entweder sind wir online, oder wir haben keine Mails zu
> versenden"
> exit
> fi
> ##################################

Thanks for your work here, those scritps are a great discovery.

Just to keep this idea going forward, a couple questions:

+ why should we run it every while, and not directly some X
seconds after creating the queue? If we do it this way, each
message could be sent a fixed time after we "send" it from within
emacs, and we would have an "unsend" like Gmail have...

+ msmtp-enqueue.sh seems to have this check inside itself (sorry
if I'm wrong, I'm a UX guy).

--8<---------------cut here---------------start------------->8---
[snipped script here]

# 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 SOME-IP-ADDRESS > /dev/null
#if [ $? -eq 0 ]; then
# msmtp-runqueue.sh > /dev/null &
#fi
--8<---------------cut here---------------end--------------->8---

Doesn't this check the net connection and if it's ok, sends the
mail with runqueue.sh?

If this is so, AND we'de like the "unsend" feature, maybe we
should insert some wait seconds before the ping... :)

Eduardo Mercovich

unread,
Aug 2, 2017, 1:29:30 PM8/2/17
to mu-di...@googlegroups.com
Hi Thorsten.

> this tiny script seems to work. It checks if we are online and
> if
> ~/.msmtpqueue is not empty. If both conditions are true it runs
> msmtp-runqueue.sh if not the script stops to run [...]

Your solution works flawlessly. For those that are using msmtp, no
change is needed except to call the queue script instead of the
usual msmtp
In my config, this is the relevant part:

--8<---------------cut here---------------start------------->8---
;; originalmente
;; sendmail-program "/usr/bin/msmtp"
;; del thread de envío inmediato
[[mu4e:msgid:87tw1te...@biologica.mercovich.net][Re:... (no
subject)]]
sendmail-program "/home/youruser/bin/msmtpqueue/msmtp-enqueue.sh"
--8<---------------cut here---------------end--------------->8---

Thanks and congratulations. :)

Looking for idea of a few seconds of "unsend" possibility, I found
an interesting and quite elegant solution in
https://github.com/sup-heliotrope/sup/wiki/Msmtp

It uses incron ("... an "inotify cron" system. It works like the
regular cron but is driven by filesystem events instead of time
periods") to launch the runqueue script after the msmtp-enqueue
finishes writing the file. In your more refined case, you check
1st for connection, and then send the mail if we're online.

So, a possible sequence with all the steps could be:

1. mu4e "sends" with msmtp-enqueue.sh and comes back in a blink.

2. upon closing the write file, incron launches your script that
a. sleep 10 secs (not yet there)
b. checks the connection
c. if connection=yes, sends the mail.
d. if connection=no, wait 1 minute and tries again.

Do you think this script would be ok? (again, sorry if it's
obvious for you guys, but I'm a UX person and I don't know much
about these things, although I'm slowly learning).

Thanks a lot... :)

Thorsten Grothe

unread,
Aug 2, 2017, 4:37:56 PM8/2/17
to mu-di...@googlegroups.com
Hi Eduardo,

* Eduardo Mercovich: 02.08.2017 (17:29):


[...]

> Your solution works flawlessly. For those that are using msmtp, no change is
> needed except to call the queue script instead of the usual msmtp
> In my config, this is the relevant part:
>
> --8<---------------cut here---------------start------------->8---
> ;; originalmente
> ;; sendmail-program "/usr/bin/msmtp"
> ;; del thread de envío inmediato
> [[mu4e:msgid:87tw1te...@biologica.mercovich.net][Re:... (no subject)]]
> sendmail-program "/home/youruser/bin/msmtpqueue/msmtp-enqueue.sh"
> --8<---------------cut here---------------end--------------->8---
>
> Thanks and congratulations. :)

I’m glad that it works for you, unfortunately I’m very busy at the
moment. I’ll try to answer tomorrow in detail :-)

[...]

>
> Thanks a lot... :)

You are welcome!

Regards

Thorsten Grothe


Eduardo Mercovich

unread,
Aug 2, 2017, 8:58:51 PM8/2/17
to mu-di...@googlegroups.com
Hi Thorsten.

[...]

>> Your solution works flawlessly. For those that are using msmtp,
>> no change is needed except to call the queue script instead of
>> the usual msmtp [...] Thanks and congratulations. :)

> I’m glad that it works for you, unfortunately I’m very busy at
> the moment.

No need to rush at all, sorry if I seemed to expect that. :)

> I’ll try to answer tomorrow in detail :-)

Well, based on your script and the incron idea joined, I took
courage, touched the scripts and... it works. :)

C-c C-c makes the mail blink for an instant and it's gone with
emacs/mu4e back to keep working. At that instant the relevant
files appear in the queue directory. Then, nothing happens for 10
seconds until runqueue kicks in, checks net connection and if ok,
network outgoing traffic peaks and some time after the files in
the queue directory disappear. :)

Thank you very much.
With this, mu4e gets even better. :)

Best regards...

Thorsten Grothe

unread,
Aug 3, 2017, 3:08:35 PM8/3/17
to mu-di...@googlegroups.com
Hi Eduardo,

* Eduardo Mercovich: 03.08.2017 (00:58):

[...]

> No need to rush at all, sorry if I seemed to expect that. :)

well I’m very interested to see how things going on…

Unfortunately I’m out of office for the next 12 days I’ll answer when
I’m back!


Regards

Thorsten Grothe

Thorsten Grothe

unread,
Aug 22, 2017, 7:35:40 AM8/22/17
to mu-di...@googlegroups.com
Hi Eduardo,

I’m a bit late with my answer, but I think I found another way to make mu4e
a bit better :-)

* Eduardo Mercovich: 03.08.2017 (00:58):

>>> Your solution works flawlessly. For those that are using msmtp, no change is
>>> needed except to call the queue script instead of the usual msmtp [...]
>>> Thanks and congratulations. :)

in mu4e conf I added only:
(setq sendmail-program "/usr/local/bin/msmtp-enqueue.sh")


[...]

> C-c C-c makes the mail blink for an instant and it's gone with emacs/mu4e back
> to keep working. At that instant the relevant files appear in the queue
> directory. Then, nothing happens for 10 seconds until runqueue kicks in, checks
> net connection and if ok, network outgoing traffic peaks and some time after the
> files in the queue directory disappear. :)

this is the first script I posted some time ago:

##
#!/bin/bash
FILE=""
DIR="/home/manjothor/.msmtpqueue"

# Check if we are online and run run_msmtp_runqueue.sh
# if not exit script.

if ping -c 1 google.com >> /dev/null 2>&1 && [ "$(ls -A $DIR)" ]; then
sh msmtp-runqueue.sh
else
exit
fi
##

I tested your incron suggestion with no luck, it does not work for me,
don’t know why, so I decided to wrote my own script. I watches the
~/.msmtpque dir and runs the first script above if something
changes. Additionally it saves terminal messages to ~/.msmtpque.log

##
#!/bin/bash

# Install inotify-tools package on your system!

dir1=~/.msmtpqueue/
while inotifywait -qqre modify "$dir1"; do
sleep 10
sh ~/.emacs.d/scripts/run_msmtp_runqueue.sh >>~/.msmtpque.log
done
##

Both scripts live in ~/.emacs.d/scripts and are executable. So the only
additional lib you need to install is (on Arch linux here)
inotify-tools. I’m using xfce4 here and start the script via session
manager on login. I works fine for me. This way one has no delay when
sending mails with large attachments in mu4e. Maybe it helps
someone.

Regards

Thorsten Grothe






Eduardo Mercovich

unread,
Aug 22, 2017, 6:54:49 PM8/22/17
to mu-di...@googlegroups.com
Hi Thorsten.

> [...] I think I found another way to make mu4e a bit better :-)

[...]

>> C-c C-c makes the mail blink for an instant and it's gone with
>> emacs/mu4e back to keep working. At that instant the relevant
>> files appear in the queue directory. Then, nothing happens for
>> 10 seconds until runqueue kicks in, checks net connection and
>> if ok, network outgoing traffic peaks and some time after the
>> files in the queue directory disappear. :)

[...]

> I tested your incron suggestion with no luck, it does not work
> for me, don’t know why, so I decided to wrote my own script.
> [...]
> Both scripts live in ~/.emacs.d/scripts and are executable. So
> the only additional lib you need to install is (on Arch linux
> here) inotify-tools. I’m using xfce4 here and start the script
> via session manager on login. I works fine for me. This way one
> has no delay when sending mails with large attachments in mu4e.
> Maybe it helps someone.

I'm sure it will.
Diversity is a measure of richness, so any other solution to this
situation/request is welcome. :)

Thank you very much.
Reply all
Reply to author
Forward
0 new messages