jwiegley / emacs-async

Simple library for asynchronous processing in Emacs
GNU General Public License v3.0
832 stars 68 forks source link

resend async email. #64

Open zw963 opened 8 years ago

zw963 commented 8 years ago

Hi, I use mu4e, and use emacs-async package to sent email.

But, in some case, when I sent, I found the internet is not connect.

In this case, my sent email is moved to Maildir: /sent, But, the email is not sent out actually.

How to do for this case?

Thanks.

zw963 commented 8 years ago

See log, I could see:

Sending via mail...
Delivering message to opensuse@opensuse.org...

If internet is available when sent, correct output is:

[mu4e] Message sent
Delivering message to opensuse@opensuse.org...done

Current, my internet is not so stable, is there exist a workaround for this?

thanks

thierryvolpiatto commented 8 years ago

Billy.Zheng notifications@github.com writes:

See log, I could see:

Sending via mail... Delivering message to opensuse@opensuse.org...

If internet is available when sent, correct output is:

[mu4e] Message sent Delivering message to opensuse@opensuse.org...done

Current, my internet is not so stable, is there exist a workaround for this?

If your connection is unstable, you should use by default mu4e in queued mode, when you are sure you are well connected flush all your queued mails.

I agree this is a problem but it is hard to fix this only on the async side, probably we should find a solution both on mu4e and async-smtp. (i.e telling mu4e the mail have been sent from the async callback)

Thierry

zw963 commented 8 years ago

I create a issue for mu project too, thanks

My network is not so bad in most case though.

But this case will happen occasionally.

the problem is if this case happen, I hard to do the resend operation. I have to copy this email content and create a new mail send it again. I think this operation maybe make mu4e index broken.

It is a very bad experience for me, currently, I prefer to waiting email is sent and not use async email package. it better ...

jwiegley commented 8 years ago

This is definitely a bug. The a sinking on package is supposed to signal an error if the email fails to send, which would leave the buffer in an unsent status.

At the moment, this is just an experimental package to show proof of concept. I would recommend not using it in light of this problem.

thierryvolpiatto commented 8 years ago

John Wiegley notifications@github.com writes:

This is definitely a bug. The a sinking on package is supposed to signal an error if the email fails to send, which would leave the buffer in an unsent status.

This is too late, when the error is sent (if it was) mu4e or whatever mua have moved the email to sent recipient, it is why I said we have to find a fix in both packages (probably around the message-sent-hook usage).

At the moment, this is just an experimental package to show proof of concept. I would recommend not using it in light of this problem.

I use it since months, and when used on a valid connection it is safe to use (this email have been sent async).

Thierry

thierryvolpiatto commented 7 years ago

You can modify the value of smtpmail-queue-mail automatically when your network is connected or disconnected. This ensure your mails are queued when network is disconnected. You can achieve this by installing https://github.com/tromey/emacs-network-manager library and using something like this:

(use-package NetworkManager
    :config
    (NetworkManager-add-listener
     (lambda (state)
       (setq smtpmail-queue-mail (not state))
       (when (eq major-mode 'mu4e-main-mode)
         (let ((pos (point)))
           (mu4e~main-view-real nil nil)
           (goto-char pos))))))
zw963 commented 7 years ago

@thierryvolpiatto , Cool! I will try it later.

Thanks