Schedule mails inside mu4e to allow for "undo send"
Emacs Lisp

README.org

mu4e-send-delay

Purpose

Allowing to schedule mails to be sent at a later time. Thus enabling the ability to “undo send” mails.

I’m aware of benmaughen’s mu4e-delay but it was lacking features which I wanted. Thanks to him for the inspiration and to Kai Großjohann for gnus-delay.el which I copied code from. (mu4e-send-delay-add-delay-header)

Features:

  • mu4e context support
  • Saves scheduled mails to mu4e-drafts-folder
  • Uses an emacs timer to check Drafts if a mail is scheduled to be sent now
  • Allows easy edit of the X-Delay header in mu4e-compose-mode
  • Displays scheduled time in mu4e-view
  • Doesn’t send if mail is currently being edited
  • Works with attachments

Install

  1. Put mu4e-send-delay.el into a directory in you load-path and require it.
(add-to-list 'load-path "path/to/directory") ; that contains mu4e-send-delay.el
(require 'mu4e-send-delay)
  1. Setup mu4e-send-delay-setup
(mu4e-send-delay-setup) ; sets up headers to show up by default
  1. Initialize the timer that works through the Drafts to send delayed mails
(add-hook 'mu4e-main-mode-hook 'mu4e-send-delay-initialize-send-queue-timer)

Requirements

  • Has only been tested on Emacs 24.5 and later
  • With mu 0.9.16

Particularies

Right now the sent buffer will be re-encoded to utf-8, to avoid mml.el complaining upon a scheduled sent. If you notice your mails arriving garbled despite looking okay in the Drafts, please consider the following emacs options:

(prefer-coding-system 'utf-8)
(set-language-environment "UTF-8")

Recommended settings

Assigning the scheduled enabled send to C-c C-c

(add-hook 'mu4e-main-mode-hook (lambda ()
                                 (define-key mu4e-compose-mode-map
                                   (kbd "C-c C-c")
                                   'mu4e-send-delay-send-and-exit)))

Now you can C-c C-c every mail

Defaults

  • mu4e-send-delay-default-delay is set to “3m”
  • mu4e-send-delay-timer is set to every 2 minutes
  • mu4e-send-delay-include-header-in-draft is true
  • mu4e-send-strip-header-before-send is true