Replies: 4 comments 3 replies
-
|
any ideas?? |
Beta Was this translation helpful? Give feedback.
-
|
This can be done with the find command: find ./cur -type f -size +50M # find files larger than 50mb
find ./cur -type f -mtime +30 # find files older than 30 days# Move mails older than 30 days to /my-archive
find ./cur -type f -mtime +30 -exec mv {} /my-archive/ \; |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. Great search terms. Thank you. Is there a way to extract attachments. The main issue is with large attachments I receive where I'd like to keep the email but remove the attachment from the mail folder. |
Beta Was this translation helpful? Give feedback.
-
|
Actually it seems Dovecot has support for storing attachments separately:
You can see there's a threshold size for when the attachment is split off to attachment storage dir. So those two settings are straightforward, while
Likewise the equivalent settings between these versions for
DMS however uses docker-mailserver/target/dovecot/10-mail.conf Lines 30 to 31 in c9aac24 DMS presently does support changing that to a different format docker-mailserver/target/scripts/startup/setup.d/dovecot.sh Lines 59 to 72 in c9aac24 It seems that may be required for the attachment feature as the Dovecot docs suggest that Migrating your existing mail to a different storage format would be another task for you to suss out, although I think this has been covered in other discussions should you need to tackle that too. Here is how to get this functionality in DMS with the following (for Dovecot 2.3), I've verified it to work: services:
dms:
image: ghcr.io/docker-mailserver/docker-mailserver:latest # :15.0
hostname: mail.example.internal
environment:
# Updates `mail_location` with `sdbox` or `mbox` (default is `maildir`):
# NOTE: Support for alternative mailbox formats is not well tested in DMS
DOVECOT_MAILBOX_FORMAT: mdbox
volumes:
# Use whatever you like for paths here, so long as the target path in the
# container matches the path for the `dovecot.cf` override setting `mail_attachment_dir`
#
# NOTE: Dovecot expects ownership (5000:5000 default in DMS)
# Might differ for LDAP if not corrected there, otherwise should be configurable via `DMS_VMAIL_UID`:
# https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/#dms_vmail_uid
- ./dovecot-attachments:/srv/dovecot/attachments
configs:
- source: dms-accounts
target: /tmp/docker-mailserver/postfix-accounts.cf
- source: dovecot-override
target: /tmp/docker-mailserver/dovecot.cf
# Remove this if you're providing your own DMS config volume for
# `/tmp/docker-mailserver` with equivalent files.
configs:
dms-accounts:
content: |
john.doe@example.internal|{SHA512-CRYPT}$$6$$sbgFRCmQ.KWS5ryb$$EsWrlYosiadgdUOxCBHY0DQ3qFbeudDhNMqHs6jZt.8gmxUwiLVy738knqkHD4zj4amkb296HFqQ3yDq4UXt8.
dovecot-override:
content: |
# Add support for storing mail attachments at a different location:
mail_attachment_fs = posix
mail_attachment_dir = /srv/dovecot/attachments
mail_attachment_min_size = 128k# Start DMS and shell into it:
$ docker compose up -d --force-recreate
$ docker compose exec -it dms bash
# Create a sparse file of 1MB size to test as an attachment:
$ truncate -s 1MB /tmp/example.dat
# Send a mail with that file attached:
$ swaks --server localhost \
--from alice.doe@example.internal --to john.doe@example.internal \
--header "Subject: This is an attachment example" \
--attach-name example.dat --attach @/tmp/example.dat
# Attachment was split off into expected location:
$ du -shx /srv/dovecot/attachments
1016K /srv/dovecot/attachments
$ du -shx /var/mail
64K /var/mail |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am getgin fairly large mail folders with some
curover 50GB ,mainly due to received emails with file attachments of 10-30MB. Is there a clever way to archive large emails? Or alternativelly an automated way to extract the attachments?Beta Was this translation helpful? Give feedback.
All reactions