Skip to content

Schedule mails inside mu4e to allow for "undo send"

Notifications You must be signed in to change notification settings

krisbalintona/mu4e-send-delay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 

Repository files navigation

mu4e-send-delay: Schedule send emails

Description

Delay sending mail by a desired amount of time. Similar to Gmail’s “schedule send” feature, which sends emails after a designated amount of time, rather than immediately. This was repo is fork of the original, bennyandresen/mu4e-send-delay, which was forked from benmaughen’s mu4e-delay.

This fork has several notable differences from the original. They are listed below:

  1. Refactored code. Works with the latest versions of mu4e and is more hackable.
  2. Several default values changed to be more sensible.
  3. Addressed several undesirable interactions users may come across.
  4. Has explicit support for Org-msg.

Be aware that this fork has not been thoroughly tested yet, and bugs may be present. I advise that users do limited testing on their configuration (e.g. sending emails to themselves) prior to actual use.

Features

  • mu4e context support
  • Saves scheduled mails to mu4e-drafts-folder
  • Uses an Emacs timer to check if delayed 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

Requirements

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

Manual

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)

Straight.el

To install this fork, provide a special recipe to straight:

(use-package mu4e-send-delay
  :straight (:type git :host github :repo "krisbalintona/mu4e-send-delay")
  :hook (mu4e-main-mode . mu4e-send-delay-setup)) ; or similar hooks

Elpaca

Do the same with elpaca:

(use-package mu4e-send-delay
  :elpaca (:type git :host github :repo "krisbalintona/mu4e-send-delay")
  :hook (mu4e-main-mode . mu4e-send-delay-setup)) ; or similar hooks

Setup

Simply run the mu4e-send-delay-setup, either manually or through a hook. This command

  1. sets up a timer to check if a delayed email should be sent (see mu4e-send-delay-timer)
  2. automatically inserts the “X-Delay” header to emails (see mu4e-send-delay-header)

Finally, mu4e-send-delay-send-and-exit

:general ([remap message-send-and-exit] ‘mu4e-send-delay-send-and-exit)

How it works

This package adds a “X-Delay” header (see mu4e-send-delay-header) to emails. The value of this header is the amount of time after the user “sends” this email that this email should actually be sent. For acceptable values, read the docstring of mu4e-send-delay-parse-delay-header-string.

The user must call the mu4e-send-delay-send-and-exit command in an mu4e-compose buffer for their email to be delayed. If called with a prefix argument, the email is sent immediately, with no delay, via message-send-and-exit.

Emails whose emails are delayed are saved as drafts in the mu4e-drafts-folder. Once mu4e-send-delay-send-due-timer is run, then all delayed emails are sent. Users can manually send delayed emails by running the command mu4e-send-delay-send-due.

Configuration

Keybinds

The command mu4e-send-delay-send-and-exit is responsible for initiating mu4e-send-delay’s functionality. Therefore, users should bind it to a key. The best option is to remap message-send-and-exit, the command bound to C-c C-c in mu4e-compose-map and message-mode-map.

(define-key mu4e-compose-mode-map [remap message-send-and-exit] 'mu4e-send-delay-send-and-exit)

Org-msg

This package is compatible with Org-msg. The only configuration necessary is setting mu4e-send-delay-enable-org-msg to a non-nil value.

Be aware that if mu4e-send-delay-enable-org-msg is non-nil mu4e-send-delay overrides org-msg-ctrl-c-ctrl-c. Look at mu4e-message-send-delay-org-msg-ctrl-c-ctrl-c to see what is done.

Variables

  • mu4e-send-delay-default-delay is the default value for the “X-Delay” header
  • mu4e-send-delay-timer is the interval in which mu4e-send-delay-send-due-timer is run
  • mu4e-send-delay-include-header-in-draft controls whether the delay header is added during composition or right before the user sends the email (with mu4e-send-delay-send-and-exit)
  • mu4e-send-strip-header-before-send controls whether to remove the header once sent so that it does not appear in recipients’ copy of the email

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")

About

Schedule mails inside mu4e to allow for "undo send"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 100.0%