unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47330: [PATCH] Add options to save sent mail
@ 2021-03-22 22:04 Andrea G. Monaco
  2021-03-23  7:26 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrea G. Monaco @ 2021-03-22 22:04 UTC (permalink / raw)
  To: 47330


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)





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#47330: [PATCH] Add options to save sent mail
  2021-03-22 22:04 bug#47330: [PATCH] Add options to save sent mail Andrea G. Monaco
@ 2021-03-23  7:26 ` Eli Zaretskii
  2021-03-23 21:13 ` Andrea G. Monaco
  2021-03-23 21:21 ` Andrea G. Monaco
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2021-03-23  7:26 UTC (permalink / raw)
  To: Andrea G. Monaco; +Cc: 47330

> From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
> Date: Mon, 22 Mar 2021 23:04:56 +0100
> 
> 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

This happens already if you add the Fcc header to the message, AFAIK.
Why is there a need for a separate global knob, when you can specify
that on a per-message basis?

Thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#47330: [PATCH] Add options to save sent mail
  2021-03-22 22:04 bug#47330: [PATCH] Add options to save sent mail Andrea G. Monaco
  2021-03-23  7:26 ` Eli Zaretskii
@ 2021-03-23 21:13 ` Andrea G. Monaco
  2021-03-23 21:21 ` Andrea G. Monaco
  2 siblings, 0 replies; 5+ messages in thread
From: Andrea G. Monaco @ 2021-03-23 21:13 UTC (permalink / raw)
  To: 47330


  > This happens already if you add the Fcc header to the message,
  > AFAIK.

This is not mentioned in the docs. Also, I think it's a bit of a hack,
it sends mail back and forth needlessly and lumps it with other received
mail.
I think it's more natural to save it when you send it.


Andrea Monaco





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#47330: [PATCH] Add options to save sent mail
  2021-03-22 22:04 bug#47330: [PATCH] Add options to save sent mail Andrea G. Monaco
  2021-03-23  7:26 ` 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
  2 siblings, 1 reply; 5+ messages in thread
From: Andrea G. Monaco @ 2021-03-23 21:21 UTC (permalink / raw)
  To: 47330


Wait, I thought you were talking about Bcc. I didn't see Fcc, now I
found it.


Andrea





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#47330: [PATCH] Add options to save sent mail
  2021-03-23 21:21 ` Andrea G. Monaco
@ 2021-03-24 10:30   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-24 10:30 UTC (permalink / raw)
  To: Andrea G. Monaco; +Cc: 47330

"Andrea G. Monaco" <andrea.monaco@autistici.org> writes:

> Wait, I thought you were talking about Bcc. I didn't see Fcc, now I
> found it.

So I think Message already has a facility for this, and I'm closing this
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-24 10:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 22:04 bug#47330: [PATCH] Add options to save sent mail Andrea G. Monaco
2021-03-23  7:26 ` 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

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