unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
To: 47330@debbugs.gnu.org
Subject: bug#47330: [PATCH] Add options to save sent mail
Date: Mon, 22 Mar 2021 23:04:56 +0100	[thread overview]
Message-ID: <87r1k6x2t3.fsf@autistici.org> (raw)


I think this might be useful, for me it is.



Add options to save sent mail

* lisp/gnus/message.el: add defcustoms message-save-sent-mail and
  message-sent-mail-directory
  (message-send): save sent mail if message-save-sent-mail is set



diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 1e0362a3bf..e159d50ebe 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -469,6 +469,18 @@ message-confirm-send
   :link '(custom-manual "(message)Sending Variables")
   :type 'boolean)
 
+(defcustom message-save-sent-mail nil
+  "When non-nil, save messages after successfully sending them, after running message-sent-hook."
+  :group 'message-sending
+  :group 'message-mail
+  :type 'boolean)
+
+(defcustom message-sent-mail-directory (concat message-directory "sent/")
+  "Directory where sent mail is saved, when message-save-sent-mail is set."
+  :group 'message-sending
+  :group 'message-mail
+  :type 'directory)
+
 (defcustom message-generate-new-buffers 'unsent
   "Say whether to create a new message buffer to compose a message.
 Valid values include:
@@ -4364,7 +4376,7 @@ message-send
       (message-do-fcc)
       (save-excursion
        (run-hooks 'message-sent-hook))
-      (message "Sending...done")
+      (message "Sending... done")
       ;; Do ecomplete address snarfing.
       (when (and (message-mail-alias-type-p 'ecomplete)
                 (not message-inhibit-ecomplete))
@@ -4373,6 +4385,9 @@ message-send
       (set-buffer-modified-p nil)
       (delete-auto-save-file-if-necessary t)
       (message-disassociate-draft)
+      ;; Save mail if the user wishes so
+      (if message-save-sent-mail
+          (write-file (concat message-sent-mail-directory (format-time-string "%Y%m%d-%H%M%S"))))
       ;; Delete other mail buffers and stuff.
       (message-do-send-housekeeping)
       (message-do-actions message-send-actions)





             reply	other threads:[~2021-03-22 22:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 22:04 Andrea G. Monaco [this message]
2021-03-23  7:26 ` bug#47330: [PATCH] Add options to save sent mail Eli Zaretskii
2021-03-23 21:13 ` Andrea G. Monaco
2021-03-23 21:21 ` Andrea G. Monaco
2021-03-24 10:30   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1k6x2t3.fsf@autistici.org \
    --to=andrea.monaco@autistici.org \
    --cc=47330@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).