In office, I need to send one mail to boss every day, every week, and every month. Usually I composed those mails every afternoon and leave them in a * send mail * buffer, and send them when I prepare to go home. Sometimes I forget to send the mail even if I finished composing them. The next day I found the * send mail * buffer and BANG I felt very upset.
AFAIK, there are several ways in Emacs to compose a mail and send a mail. Are there any methods to schedule a specific mail sending in a specific time, for example, at 6:00pm later that day? If not, how to write a function so that I can run the function for a specific mail and let them be sent at the given time?
This question is something different from the similar Gnus question. I want to set a different schedule for each mail to be sent.
Here I provide some pseudocode that come to my mind, but this does not works. Can anyone give me some advices? Thank you!
;; one pseudocode: (require 'midnight) (defun schedule-send-mail-in-current-buffer () (interactive ???) (prompt-and-get buffer-name) (prompt-and-get send-time) ;; like 19:00pm (rename-this-buffer buffer-name) (bury-buffer (get-buffer buffer-name)) ;; how to set this buffer to not-killable? (midnight-delay-set 'midnight-delay "19:00pm") (add-hook 'midnight-hook (lambda () (with-current-buffer buffer-name (call-interactively 'message-send))))) ;; some similar psuedocode (defun schedule-send-mail-in-current-buffer () (interactive ???) ;; days hour minute after now (prompt-and-get buffer-name) (prompt-and-get minute) (prompt-and-get hour) (prompt-and-get days) (rename-this-buffer buffer-name) (bury-buffer (get-buffer buffer-name)) ;; calc schedule-time (let ((scheduled-time (build-date-time minute hour days))) ;; if setq timer is outside defun, it works. Why cannot it work in a defun? (setq monthcheck-timer (run-at-time (encode-time (get-second scheduled-time) (get-minute scheduled-time) (get-hour scheduled-time) (get-day scheduled-time) (get-month scheduled-time) (get-year scheduled-time)) nil (lambda () (with-current-buffer buffer-name (call-interactively 'message-send)))))))