There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Docker email server to host mail archive

Hey all,

I have given up hope of hosting my own mail server but was hoping for one that would serve as an archive -

  • downloads new emails via IMAP from my mail provider on a regular basis
  • allows my mail clients to connect via IMAP to view and search emails

Any suggestions for a docker solution for this?

Thanks

conrad82 ,

I use dovecot for this. And thunderbird to actually move/archive the emails. I use caddy for many of my services, so I have pointed dovecot to caddys certificates (for “my.domain”), since it manages certificates through let’s encrypt. I had a plan to install postfix for sending internal emails from my self-hosted services, but it seemed like a bit of configuration and I got busy with other stuff

I made an excerpt from my docker-compose.yml, but you probably have to figure out some things on your own


<span style="color:#323232;">
</span><span style="color:#323232;">version: '3.4'
</span><span style="color:#323232;">
</span><span style="color:#323232;">services:
</span><span style="color:#323232;">  dovecot:
</span><span style="color:#323232;">    image: dovecot/dovecot:2.3.20
</span><span style="color:#323232;">    restart: unless-stopped
</span><span style="color:#323232;">    volumes:
</span><span style="color:#323232;">      - ./dovecot/:/etc/dovecot
</span><span style="color:#323232;">      - /mnt/storage/dovecot/mail:/srv/mail
</span><span style="color:#323232;">      - ./caddy/data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/wildcard_.my.domain/wildcard_.my.domain.crt:/etc/ssl/cert.crt
</span><span style="color:#323232;">      - ./caddy/data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/wildcard_.my.domain/wildcard_.my.domain.key:/etc/ssl/key.key
</span><span style="color:#323232;">    ports:
</span><span style="color:#323232;">      - 993:993
</span>

contents of ./dovecot folder:


<span style="color:#323232;">dovecot.conf
</span><span style="color:#323232;">passwords
</span>

contents of dovecot.conf (I think I searched online to find a good example, I don’t remember where from…)


<span style="color:#323232;">## manage this file
</span><span style="color:#323232;">
</span><span style="color:#323232;">mail_home=/srv/mail/%Lu
</span><span style="color:#323232;">mail_location=sdbox:~/Mail
</span><span style="color:#323232;">mail_uid=1000
</span><span style="color:#323232;">mail_gid=1000
</span><span style="color:#323232;">
</span><span style="color:#323232;">protocols = imap pop3 submission sieve lmtp
</span><span style="color:#323232;">
</span><span style="color:#323232;">first_valid_uid = 1000
</span><span style="color:#323232;">last_valid_uid = 1000
</span><span style="color:#323232;">
</span><span style="color:#323232;">passdb {
</span><span style="color:#323232;">  driver = passwd-file
</span><span style="color:#323232;">  args = scheme=argon2i /etc/dovecot/passwords
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">ssl=yes
</span><span style="color:#323232;">ssl_cert=</etc/ssl/cert.crt
</span><span style="color:#323232;">ssl_key=</etc/ssl/key.key
</span><span style="color:#323232;">
</span><span style="color:#323232;">namespace {
</span><span style="color:#323232;">  inbox = yes
</span><span style="color:#323232;">  separator = /
</span><span style="color:#323232;">
</span><span style="color:#323232;">  mailbox Drafts {
</span><span style="color:#323232;">    auto = subscribe
</span><span style="color:#323232;">    special_use = Drafts
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">  mailbox Sent {
</span><span style="color:#323232;">    auto = subscribe
</span><span style="color:#323232;">    special_use = Sent
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">  mailbox Spam {
</span><span style="color:#323232;">    auto = subscribe
</span><span style="color:#323232;">    special_use = Junk
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">  mailbox Trash {
</span><span style="color:#323232;">    auto = subscribe
</span><span style="color:#323232;">    special_use = Trash
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">  mailbox Archive {
</span><span style="color:#323232;">    auto = subscribe
</span><span style="color:#323232;">    special_use = Archive
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">service lmtp {
</span><span style="color:#323232;">  inet_listener {
</span><span style="color:#323232;">    port = 24
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">listen = *
</span><span style="color:#323232;">
</span><span style="color:#323232;">log_path=/dev/stdout
</span><span style="color:#323232;">info_log_path=/dev/stdout
</span><span style="color:#323232;">debug_log_path=/dev/stdout
</span>
BennyInc ,

Piggybacking on this question: any solution that provides really good indexing on those local mails, for fast wildcard searching?

tvcvt ,

I can’t give direct experience here, but this is exactly the use case I’ve been meaning to spin up mailpiler for: www.mailpiler.org. One of these days that will rise to the top of the priority list.

vegetaaaaaaa , (edited )
@vegetaaaaaaa@lemmy.world avatar

allows my mail clients to connect via IMAP to view and search emails

dovecot will be able to handle this part. This is what I use as a mail archive (once a year, archive all mail from the previous year from various mailboxes to my self-hosted dovecot instance). I wrote this ansible role for it.

downloads new emails via IMAP

As others recommended, imapsync should be able to handle that part.

docker solution

These tools are simple enough to install and manage (one package, one config file), Docker is not needed. If you really need it to fit into your docker-based setup, build and maintain your own images.

lnxtx ,
@lnxtx@feddit.nl avatar

I think imapsync will fulfill your needs.

Dunstabzugshaubitze ,

github.com/docker-mailserver/docker-mailserver should be able to do it.

if i remember this in 6 weeks i’ll check the setup at work.

Diplomjodler3 ,

Paperless-ngx might be worth a look. Probably overkill if you just want to store mails but great for general purpose document management.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines