Github messages for mblaze
 help / color / mirror / Atom feed
* [ISSUE] The proper way to delete mails?
@ 2023-03-30 13:39 hills
  2023-03-30 13:43 ` leahneukirchen
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hills @ 2023-03-30 13:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

New issue by hills on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236

Description:
I'm very pleased to have discovered mblaze, thank you.

I'd like to automate deletion of some old mails, but no such example is given in the docs.

If this is as simple as "xargs rm", or should it be "mflag -T"?

If I use the latter, is there an mblaze command to actually delete "trashed" mails?

Just a single example of the best practice in the docs would help.

I'm not saying a specific blaze command is needed, but one could have some safety checks. Waving "xargs rm" around makes me nervous...

In my cases, mails are served from Dovecot which keeps its own index, and therefore I'm assuming it's its own responsibility to deal with changes to the underlying Maildir.



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

* Re: The proper way to delete mails?
  2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
@ 2023-03-30 13:43 ` leahneukirchen
  2023-03-30 14:02 ` hills
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2023-03-30 13:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236#issuecomment-1490331110

Comment:
Yes, `xargs rm` should work (modulo usual quoting issues). You can also flash as trashed and let the IMAP server expire it.

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

* Re: The proper way to delete mails?
  2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
  2023-03-30 13:43 ` leahneukirchen
@ 2023-03-30 14:02 ` hills
  2023-03-30 14:06 ` leahneukirchen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hills @ 2023-03-30 14:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

New comment by hills on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236#issuecomment-1490361071

Comment:
Thanks for such a quick reply.

I don't think my IMAP server automatically does this (though there's a command at my client, alpine, to "purge")

> (modulo usual quoting issues)

I suppose that's another good reason for a dedicated command (could be equivalent of rm or even xargs for mails): ensure one message per-line and have a safety check that the filename (and possibly first block of content) looks like a mail message.

In the spirit of community, shall I see if I can patch the docs so people don't need to ask again.

The existing example:

`mdirs ~/Maildir | xargs minc | mthread | mless`

there's no consideration for pathnames with spaces. So should I just follow in the spirit of it being an example, with a simple xargs again:

`mlist ~/Maildir | mpick -t 'mtime < "-365d"' | xargs rm`

Because the full example gets cluttered and is probably only moving the goalposts:

`mlist ~/Maildir | mpick -t 'mtime < "-365d"' | xargs -d '\n' -r rm



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

* Re: The proper way to delete mails?
  2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
  2023-03-30 13:43 ` leahneukirchen
  2023-03-30 14:02 ` hills
@ 2023-03-30 14:06 ` leahneukirchen
  2023-03-30 14:06 ` leahneukirchen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2023-03-30 14:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236#issuecomment-1490369158

Comment:
You may like my other project https://github.com/leahneukirchen/xe/ which is xargs with reasonable defaults. ;)

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

* Re: The proper way to delete mails?
  2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
                   ` (2 preceding siblings ...)
  2023-03-30 14:06 ` leahneukirchen
@ 2023-03-30 14:06 ` leahneukirchen
  2023-03-30 14:13 ` hills
  2023-10-27  7:32 ` Anachron
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2023-03-30 14:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236#issuecomment-1490369697

Comment:
I'll add an `mrm` script to contrib at some point.

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

* Re: The proper way to delete mails?
  2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
                   ` (3 preceding siblings ...)
  2023-03-30 14:06 ` leahneukirchen
@ 2023-03-30 14:13 ` hills
  2023-10-27  7:32 ` Anachron
  5 siblings, 0 replies; 7+ messages in thread
From: hills @ 2023-03-30 14:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

New comment by hills on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236#issuecomment-1490381764

Comment:
> You may like my other project https://github.com/leahneukirchen/xe/ which is xargs with reasonable defaults. ;)

Brilliant! I was thinking exactly that as I wrote the previous message.

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

* Re: The proper way to delete mails?
  2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
                   ` (4 preceding siblings ...)
  2023-03-30 14:13 ` hills
@ 2023-10-27  7:32 ` Anachron
  5 siblings, 0 replies; 7+ messages in thread
From: Anachron @ 2023-10-27  7:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

New comment by Anachron on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/236#issuecomment-1782438887

Comment:
To give you another idea on how to do it, I wrote a script to automatically move old mails to an "ARCHIVE" mailbox which isn't synced back to the server.

This way I don't clutter my inbox while still being able to read them later if needed to.

```sh
#!/bin/sh

MAILACC="${1}"
MAILINBOX="${HOME}/usr/mls/${MAILACC}/INBOX"
MAILARCHIVE="${HOME}/usr/mls/${MAILACC}/ARCHIVE"
MAILYEAR=$(echo "$(date +%Y) -2" | bc -s)

test -d "${MAILINBOX}" || exit 1

! test -d "${MAILARCHIVE}" && mmkdir "${MAILARCHIVE}"
printf 'Searching for messages older than %s-01-01\n' "${MAILYEAR}"
ml=$(mlist "${MAILINBOX}" | mpick -t 'date <= "'"${MAILYEAR}"'-01-01"' | msort -d)
test -n "${ml}" || { printf 'Nothing found!\n'; exit; }
printf 'Archiving %s messages\n' $(printf '%s\n' "${ml}" | wc -l)
printf '%s\n' "${ml}" | mrefile "${MAILARCHIVE}"
printf 'Creating inbox sequence\n'
mlist "${MAILINBOX}" | msort -r -d > "${HOME}/usr/mls/${MAILACC}/inbox.seq"
printf 'Creating archive sequence\n'
mlist "${MAILARCHIVE}" | msort -r -d > "${HOME}/usr/mls/${MAILACC}/archive.seq"
```

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

end of thread, other threads:[~2023-10-27  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 13:39 [ISSUE] The proper way to delete mails? hills
2023-03-30 13:43 ` leahneukirchen
2023-03-30 14:02 ` hills
2023-03-30 14:06 ` leahneukirchen
2023-03-30 14:06 ` leahneukirchen
2023-03-30 14:13 ` hills
2023-10-27  7:32 ` Anachron

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 NNTP newsgroup(s).