Giter Club home page Giter Club logo

getmail-container's Introduction

getmail-container

getmail-container is a docker image containing an IMAP server and email fetcher: dovecot and getmail6. It is used for gathering emails from multiple accounts on a private IMAP server while using a remote SMTP server for sending emails.

This docker container is inspired the work of Joel Porquet:
http://web.archive.org/web/20200807233801/https://joel.porquet.org/wiki/hacking/getmail_dovecot/

+-----------+              +-----------+               +--------------+
| ISP       |              | DOCKER    |               | LAPTOP       |
|           |              |           |           +-->|--------------|
| +-------+ | push/delete  | +-------+ | push/sync |   |  MAIL CLIENT +---+
| | IMAPS +----------------->| IMAPS +<------------+   +--------------+   |
| +-------+ |              | +-------+ |           |   +--------------+   |
| +-------+ |              |           |           |   | ANDROID      |   |
| | SMTP  |<-------+       |           |           +-->|--------------|   |
| +-------+ |      |       |           |               |  MAIL CLIENT +---+
+-----------+      |       +-----------+               +--------------+   |
                   +------------------------------------------------------+
Joel's original diagram.

Usage

Required volumes:

  • /home: mounted users directories (Maildir in fs layout, sieve, .getmail)
  • /etc/ssl/private: mounted TLS certificates (tls.crt, tls.key)

Environment Variables

  • CRON: getmail will be called by cronjob to retrieve emails. Specify your schedule in cron format. Default is every 30 minutes CRON="*/30 * * * *" (don't forget the quotes). Keep in mind that some mail providers will block high frequent retrieving.
  • TZ= set local timezone. Default is TZ=UTC

Prepare your getmailrc account configurations per user (/srv/mail/home/user/.getmail/[email protected]):

# ~/.getmail/getmailrc-*: getmailrc email configuration

[retriever]
type = SimpleIMAPSSLRetriever
server = imap.email.invalid
username = [email protected]
port = 993
password = password
mailboxes = ("INBOX", "Sent", "Spam")

[destination]
type = MDA_external
path = /usr/lib/dovecot/deliver
arguments = ("-e", "-m", "%(mailbox)")

[options]
read_all = false
delete_after = 30
delivered_to = false
received = true
verbose = 1

And finally start it with docker, or your container manager of choice (podman, kubernates etc.).

$ docker run -d -v /srv/mail/home:/home -v /srv/mail/cron.d:/etc/cron.d -v /srv/mail/ssl:/etc/ssl/private:ro -p 143 -p 993 -p 4190 --name mail ghcr.io/tctlrd/ddg6

Or use docker-compose (check out docker-compose.example.yml).

Users are created automatically with default password (replaceMeNow) on first start. To reset user passwords (of a running container):

$ docker exec -it mail passwd [user]

Sieve Filters

If you are using Sieve filters and want a Refilter mailbox to trigger their refiltering, create a refilter configuration per user (/srv/mail/home/user/.getmail/getmailrc-refilter):

# ~/.getmail/getmailrc-*: getmailrc refilter configuration

[retriever]
type = SimpleIMAPRetriever
server = localhost
port = 143
username = user
password = password
mailboxes = ("Refilter",)

[destination]
type = MDA_external
path = /usr/lib/dovecot/deliver
arguments = ("-e",)

[options]
read_all = false
delete = true
delivered_to = false
received = false
verbose = 1

Pull Requests are Welcome

Go ahead and improve this project and submit a pull request.

License

This library is licensed under the GNU Affero General Public License 3.0+ (AGPL-3.0+). Note that it is mandatory to make all modifications and complete source code of this library publicly available to any user.

getmail-container's People

Contributors

tctlrd avatar gw0 avatar balli1187 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.