I use mu4e and mu4e-send-delay. When I send a message immediately and don't have an internet connection, I see this message in the mini-buffer:

smtp.domain.tld/25 nodename nor servname provided, or not known

The message remains open in the Emacs frame with some changes such as the FCC header with the destination filepath and is saved to Drafts.

When I delay sending mail with mu4e-send-delay, at the time of sending, the mini-buffer shows Sending via mail.... If I have no internet connection at the time of sending, a pop-up appears in Emacs:


Buffer *temp* modified; kill anyway?

[Yes] [No]

If I click Yes, the mini-buffer changes to Buffer *temp* modified; kill anyway? y. If I click No, the mini-buffer changes to Buffer *temp* modified; kill anyway? n and I get a file similar to *message*-20190627-105554 saved in the home directory with the content of the message:

User-agent: mu4e 1.2.0; emacs 26.2
From: ...
To: ...
Subject: ...
Fcc: /path/to/maildir/Sent Items/cur/1561629089.e6e765d7b4ad6364.hostname:2,S
Date: Thu, 27 Jun 2019 11:01:54 +0100
Message-ID: <[email protected]>
--text follows this line--

Annoyingly, I get a new saved message with the same content every time I click No in the Emacs pop-up.

How can I avoid these annoying pop-ups every time the queue timer runs without an internet connection?

1 Answer 1



Use my fork instead, which tests for an internet connection before sending each message.


I played with the source code and the issue is in the function mu4e-send-delay-send-if-due, which calls (message-send-mail) on line 258. The help for this last function shows:

message-send-mail is a compiled Lisp function in ‘message.el’.

and its source code modifies the buffer and then calls kill-buffer without options for confirmation.

(defun message-send-mail (&optional _)
    (kill-buffer tembuf))

My solution was to check for an internet connection before trying to send each message. I could have done that check at function mu4e-send-delay-send-queue, but if the client has no internet connection but also no messages to send, I didn't want to print a message when the queue timer ran. So I put it in the function that tries to send the message instead at the cost of printing a new message on the mini-buffer for each message in the queue. I used the internet check from here:

(defcustom mu4e-internet-host-test "www.gnu.org"
  "Host to test internet connection before sending mail."
  :type 'string
  :group 'mu4e-delay)

(defun mu4e-internet-up-p (&optional host)
  "Test if internet connection is up (default host is defined by custom variable
  (= 0 (call-process "ping" nil nil nil "-c" "1" "-W" "1" 
             (if host host mu4e-internet-host-test))))

(defun mu4e-send-delay-send-if-due (mail-file-path)
  "Send mail when MAIL-FILE-PATH contains scheduled time earlier
than current time and is not currently being edited."
  (when (and (mu4e-send-delay-elapsed-p mail-file-path)
             (not (mu4e-send-delay-file-buffer-open mail-file-path)))
    (if (not (mu4e-internet-up-p))
    (message "mu4e: unable to send queued message for lack of internet connection")
    ... ;; same code as before, with an extra parenthesis
    (error "mu4e-send: %s" err)))))

I filed an issue and proposed a pull request with this fix but the repo seems inactive. If the pull request is not merged, use my fork instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.