* make it configurable what to do with sent messages (part 2), and document it:

By default, @t{mu4e} puts a copy of any messages you sent in the folder you
set for @code{mu4e-sent-folder}. In some case, this may not be what you want -
for example, when using GMail+@abbr{IMAP} (but @emph{not} with
GMail+@abbr{POP3}), this interferes with GMail's handling of the sent messages
folder, and you may end up with duplicate messages. For this, since @t{mu4e}
0.9.8.3, there is the variable @code{mu4e-sent-messages-behavior}, which takes
a symbol. The default is @code{'sent} which, as stated causes the message to
be copied to your sent-messages folder. Other possible values are
@code{'trash} (so the sent message is copied to the trash-folder
(@code{mu4e-trash-folder}), and @code{'delete} to simply discard the message
altogether.
This commit is contained in:
djcb 2012-03-13 20:13:30 +02:00
parent 4122b76607
commit a051f3a89f
3 changed files with 70 additions and 33 deletions

View File

@ -371,9 +371,9 @@ using Gnus' `message-mode'."
`message-sent-hook'."
(let ((docid (gethash (buffer-file-name) mu4e-path-docid-map)))
(unless docid (error "unknown message (%S)" (buffer-file-name)))
(save-buffer) ;; save the messages, so emacs won't annoy us
(if (eq mu4e-sent-messages-behavior 'delete)
(progn
(save-buffer)
(mu4e-proc-remove-msg docid)) ;; remove it
(progn ;; try to save the message the sent folder
(save-excursion
@ -382,6 +382,7 @@ using Gnus' `message-mode'."
(if (search-forward-regexp (concat "^" mail-header-separator "\n"))
(replace-match "")
(error "cannot find mail-header-separator"))
(save-buffer)
;; ok, all seems well, well move the message to the sent-folder
(if (eq mu4e-sent-messages-behavior 'trash)
(mu4e-proc-move-msg docid mu4e-trash-folder "+T-D+S")

View File

@ -263,6 +263,20 @@ recommended you use \"html2text -utf8 -width 72\"."
:type 'string
:group 'mu4e-compose)
(defcustom mu4e-sent-messages-behavior 'sent
"Determines what mu4e does with sent messages - this is a symbol
which can be either:
'sent --> move the sent message to the Sent-folder (`mu4e-sent-folder')
'trash --> move the sent message to the Trash-folder (`mu4e-trash-folder')
'delete --> delete the sent message.
Note, when using GMail/IMAP, you should set this to either 'trash
or 'delete, since GMail already takes care of keeping copies in the
sent folder."
:type 'symbol
:safe 'symbolp
:group 'mu4e-compose)
;; Faces
(defgroup mu4e-faces nil

View File

@ -249,6 +249,26 @@ A very minimal setup could look something like:
Note, since @t{mu4e} uses the same @t{message mode} and @t{smtpmail}
that Gnus uses, any setting for those will also work for @t{mu4e}.
By default, @t{mu4e} puts a copy of any messages you sent in the folder you
set for @code{mu4e-sent-folder}. In some case, this may not be what you want -
for example, when using GMail+@abbr{IMAP} (but @emph{not} with
GMail+@abbr{POP3}), this interferes with GMail's handling of the sent messages
folder, and you may end up with duplicate messages. For this, since @t{mu4e}
0.9.8.3, there is the variable @code{mu4e-sent-messages-behavior}, which takes
a symbol. The default is @code{'sent} which, as stated causes the message to
be copied to your sent-messages folder. Other possible values are
@code{'trash} (so the sent message is copied to the trash-folder
(@code{mu4e-trash-folder}), and @code{'delete} to simply discard the message
altogether.
Thus, for GMail-IMAP you can add the following to your settings:
@verbatim
;; don't save message to Sent Messages, GMail/IMAP will take care of this
(setq mu4e-sent-messages-behavior 'trash)
@end verbatim
@node Queuing mail
@section Queuing mail
@ -1058,10 +1078,9 @@ realdelete = no
@end verbatim
Of course, you need replace @t{USERNAME} and @t{PASSWORD} with your actual
Gmail username and password.
GMail username and password.
After this, you can download your mail, it should look something like the
following:
After this, you should be able to download your mail:
@verbatim
$ offlineimap
OfflineIMAP 6.3.4
@ -1112,6 +1131,9 @@ Now, let's make a @t{mu4e} configuration for this:
(setq mu4e-sent-folder "/[Gmail].Sent Mail")
(setq mu4e-trash-folder "/[Gmail].Trash")
;; don't save message to Sent Messages, GMail/IMAP will take care of this
(setq mu4e-sent-messages-behavior 'delete)
;; setup some handy shortcuts
(setq mu4e-maildir-shortcuts
'( ("/INBOX" . ?i)