Giter Club home page Giter Club logo

mu4e-send-delay's Introduction

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

mu4e-send-delay's People

Contributors

bandresen avatar bennyandresen avatar thaaophz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mu4e-send-delay's Issues

Editing in drafts should revert to default value

currently it retains the initial schedule time, but that is incorrectly interpreted. # Creating issue for mu4e-send-delay. # # Write a message for this issue. The first block of # text is the title and the rest is the description.

Timer fails to run at one hour intervals

I have this custom code:

(setq mu4e-send-delay-default-delay "2h")
(setq mu4e-send-delay-timer 3600)

It is now 11:35pm and I have dozens of emails in my drafts folder all scheduled to before this date, from 1.30pm to 10pm. The value of mu4e-send-delay-send-queue-timer is:

[t 24058 22377 101966 3600 mu4e-send-delay-send-queue nil nil 0]

I don't know enough LISP to debug it. Can someone help?

Add contributor

I have submitted two pull requests for issues. It seems that this repo has had no activity for a long time. Please add me as a contributor.

brings its own mu4e~draft-common-construct

this should be worked around or requested upstream # Creating issue for mu4e-send-delay. # # Write a message for this issue. The first block of # text is the title and the rest is the description.

header isn't stripped on send

mu4e-send-strip-header-before-send is not being honored # Creating issue for mu4e-send-delay. # # Write a message for this issue. The first block of # text is the title and the rest is the description.

Message delayed too long

I have been using send-delay and it works most of the time. Sometimes, the emails is only sent much later. For example, yesterday I drafted an email at 7pm scheduled for 5 minutes later. I may have closed the computer and changed locations in the 5-10 minutes after (I am not sure). Then I reopened, reconnected, left running for 2 hours, and restarted, and the email was only sent this morning when I launched Emacs again.

I often get a message in the mini-buffer saying "Stopping call to process with quit inhibited", or something like that. Could that be the reason?

sometimes confirm dialog boxes pop-up upon sending

wasn't an issue before the fix for #5 and the move to message-mode to handle attachments # Creating issue for mu4e-send-delay. # # Write a message for this issue. The first block of # text is the title and the rest is the description.

Remove from send queue upon edit

Let's say I a message at t0 with a delay, scheduled for t1, and then go back to edit the message. The original message is still scheduled for sending. If I send the edited message after t1, then I will be sending two separate messages.

Can I remove the message from the send queue when I edit it?

Emails sent with delay appear twice

I send emails with delay using mu4e-send-delay. The repo seems out of date with the last commit 2 years ago.

I often find that emails I sent with delay are sent twice, for example a pair sent within 1 minute of each other:

Date: Mon 29 Apr 16:05:09 2019
Date: Mon 29 Apr 16:04:17 2019

an another pair within 1 second of each other:

Date: Tue 30 Apr 12:51:22 2019
Date: Tue 30 Apr 12:51:21 2019

And some pairs have exactly the same timestamp.

Nevertheless, some recipients I contacted only receive one of them.

In addition, attachments show differently, for example one email in the pair has:

Date: Mon 29 Apr 11:56:01 2019
Maildir: /Sent Items
[...body of email...]
<#part type="application/pdf" filename="/var/folders/zx/j_gjm0ld081b_mcqmg3gp9l1zp59y6/T//mu-2137171910/9ca95bbc/3/SS Programme 2019.pdf" disposition=attachment>
<#/part>

and another in the pair has:

Date: Mon 29 Apr 11:55:41 2019
Maildir: /Sent Items
Attachments: [1]SS Programme 2019.pdf(1.1M)
[...body of email...]

Fail to schedule an email ??

I have 3 accounts, 2 gmails and one exchange server. I can not seem to make mu4e-send-delay work and this is what I am getting.

If I try to schedule an email from exchange account, I got following message.
Saving file /.../mail/Drafts/cur/1489718313.3ed505347ccd2a4a.sagittarius:2,DS...
Wrote /.../mail/Drafts/cur/1489718313.3ed505347ccd2a4a.sagittarius:2,DS
[mu4e] Saved (5 lines)
mu4e-send-delay: (error [mu4e] unsupported type for ("/Exchange/Sent"))
[mu4e] Mail scheduled for sending at: mu4e-send-delay: (error [mu4e] unsupported type for ("/Exchange/Sent"))
If I try to schedule from Gmail account, I got this:
Saving file /.../mail/Drafts/cur/1489718675.87ee579c4f98342c.sagittarius:2,DS...
Wrote /.../mail/Drafts/cur/1489718675.87ee579c4f98342c.sagittarius:2,DS
[mu4e] Saved (5 lines)
mu4e-send-delay: (error [mu4e] Cannot set folder mu4e-sent-folder, account for MSG nil not detected)
[mu4e] Mail scheduled for sending at: mu4e-send-delay: (error [mu4e] Cannot set folder mu4e-sent-folder, account for MSG nil not detected)

proper drafts (not scheduled) mails throw errors

Text by Ben Maughen: " I may have found a small bug. If I save a message as a draft and then send a message with delay so that it also ends up in my drafts folder waiting to be sent, then the timer fails with the following:

Error running timer `mu4e-send-delay-send-queue': (wrong-type-argument integerp nil)

and the delayed message is not sent until I delete or send the draft message. "

investigate if a flag could be set

to quickly detect and jump to entries in the Drafts that are scheduled for sending # Creating issue for mu4e-send-delay. # # Write a message for this issue. The first block of # text is the title and the rest is the description.

edit email after schedualing

long waited feature, thanks! A few questions:
Can I set delay with 3d, 1w etc?
I can not seems to edit the emails after scheduling. any hits?
Another question is how to send the email right away? set the X-delay to 0min?

Annoying pop-up when queued email sends without internet connection

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:

Emacs-x86_64-10_14

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.

I fiddled with the code and I get this upon exit

Save file /path/to/maildir/Drafts/cur/some-id.hostname:2,DS? (y, n !, ...)

Playing with the code, the issue is in function mu4e-send-delay-send-if-due, which calls (message-send-mail). 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))
	...
	)

So I can either remove the confirmation default before calling it, and then putting it back, which is ugly, or I can check for an internet connection before trying to send. I will propose a pull request with this fix.

"Replied to" flag not being set

If I reply to a mail using mu4e-send-delay-send-and-exit, the "replied to" flag is not set when the mail is finally sent.

I had this working in mu4e-delay by using
(mu4e~compose-set-parent-flag f)
before sending the mail. I tried this quickly with mu4e-send-delay bit it didn't appear to work, but I have not had time to look at it in any detail.

Cheers,
Ben

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.