Add a docker-compose spawning Dovecot+Cyrus+Maddy
This commit is contained in:
parent
9675cdb545
commit
e72985a38c
|
@ -0,0 +1,21 @@
|
|||
# Spawn Dovecot+Maddy+Cyrus
|
||||
|
||||
Run:
|
||||
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
- Dovecot
|
||||
- listen on :993, run `openssl s_client -connect 127.0.0.1:993`
|
||||
- login with `A LOGIN test pass`
|
||||
- Maddy
|
||||
- listen on :994, run `openssl s_client -connect 127.0.0.1:993`
|
||||
- login with `A LOGIN test@example.com pass`
|
||||
- Cyrus
|
||||
- lient on :143, run `nc 127.0.0.1 143`
|
||||
- login with `A LOGIN test pass`
|
||||
|
||||
# Inject emails and dump the computed `BODY` + `BODYSTRUCTURE`
|
||||
|
||||
Once you ran `docker-compose up`, launch `./send-to-imap.py`
|
|
@ -0,0 +1,22 @@
|
|||
version: '3.4'
|
||||
services:
|
||||
dovecot:
|
||||
image: dovecot/dovecot:2.3.19.1
|
||||
ports:
|
||||
- "993:993/tcp"
|
||||
|
||||
maddy:
|
||||
build:
|
||||
context: ./docker/maddy/
|
||||
image: maddy
|
||||
ports:
|
||||
- "994:993/tcp"
|
||||
|
||||
cyrus:
|
||||
build:
|
||||
context: ./docker/cyrus/
|
||||
image: cyrus
|
||||
volumes:
|
||||
- "/dev/log:/dev/log"
|
||||
ports:
|
||||
- "143:143/tcp"
|
|
@ -0,0 +1,15 @@
|
|||
FROM debian:buster
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt update && \
|
||||
apt install -y cyrus-imapd cyrus-pop3d cyrus-nntpd cyrus-caldav cyrus-admin sasl2-bin && \
|
||||
echo "admins: cyrus" >> /etc/imapd.conf && \
|
||||
touch /var/lib/cyrus/tls_sessions.db && \
|
||||
chown cyrus:mail /var/lib/cyrus/tls_sessions.db && \
|
||||
mkdir /run/cyrus && \
|
||||
chown -R cyrus:mail /run/cyrus
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
|
||||
CMD [ "/usr/local/bin/entrypoint.sh" ]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
cyrmaster -D -l 32 -C /etc/imapd.conf -M /etc/cyrus.conf &
|
||||
sleep 2
|
||||
|
||||
echo cyrus | saslpasswd2 -p cyrus
|
||||
echo pass | saslpasswd2 -p test
|
||||
|
||||
cyradm -u cyrus -w cyrus 127.0.0.1 <<EOF
|
||||
cm user.test
|
||||
setaclmailbox user.test test kxtelrswip
|
||||
exit
|
||||
EOF
|
||||
|
||||
wait
|
|
@ -0,0 +1,16 @@
|
|||
FROM debian:buster as builder
|
||||
|
||||
WORKDIR /root
|
||||
RUN apt-get update && apt-get install -y openssl && \
|
||||
openssl req -nodes -new -x509 -subj "/C=DW/ST=Sto/L=Ankh-Morpork /O=Unseen University/OU=Library/CN=Ook/emailAddress=ook@ook.ook" -keyout privkey.pem -out fullchain.pem
|
||||
|
||||
FROM foxcpp/maddy:0.6.2
|
||||
|
||||
COPY --from=builder /root/privkey.pem /data/tls/privkey.pem
|
||||
COPY --from=builder /root/fullchain.pem /data/tls/fullchain.pem
|
||||
|
||||
ENV MADDY_DOMAIN=example.com MADDY_HOSTNAME=mx.example.com
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
maddy -config /data/maddy.conf run &
|
||||
|
||||
sleep 2
|
||||
maddyctl creds create --password pass test@example.com
|
||||
maddyctl imap-acct create test@example.com
|
||||
|
||||
wait
|
|
@ -1 +1 @@
|
|||
(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "8BIT" 16 1) "ALTERNATIVE"))
|
||||
(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "8BIT" 14 0) "ALTERNATIVE"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "8BIT" 16 1 NIL NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "festivus") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "8BIT" 14 0 NIL NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "festivus") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("text" "html" ("charset" "utf-8") NIL NIL "8bit" 16 1) "alternative"))
|
||||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("text" "html" ("charset" "utf-8") NIL NIL "8bit" 14 0) "alternative"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL)("text" "html" ("charset" "utf-8") NIL NIL "8bit" 16 1 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL)("text" "html" ("charset" "utf-8") NIL NIL "8bit" 14 0 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL))
|
|
@ -13,5 +13,4 @@ Content-Type: text/html; charset="utf-8"
|
|||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
<p>Hello 2</p>
|
||||
|
||||
--festivus--
|
||||
|
|
|
@ -1 +1 @@
|
|||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1) ("text" "html" ("charset" "utf-8") NIL NIL "8bit" 16 1) "alternative"))
|
||||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1) ("text" "html" ("charset" "utf-8") NIL NIL "8bit" 14 1) "alternative"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL) ("text" "html" ("charset" "utf-8") NIL NIL "8bit" 16 1 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL) ("text" "html" ("charset" "utf-8") NIL NIL "8bit" 14 1 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY ((("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1) "MIXED")("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1) "MIXED"))
|
||||
(BODY ((("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0) "MIXED")("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0) "MIXED"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL)("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "child") NIL NIL NIL)("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "parent") NIL NIL NIL))
|
||||
(BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL)("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "child") NIL NIL NIL)("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "parent") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY ((("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1) "mixed")("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1) "mixed"))
|
||||
(BODY ((("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0) "mixed")("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0) "mixed"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE ((("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL)("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL) "mixed" ("boundary" "child") NIL NIL NIL)("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL) "mixed" ("boundary" "parent") NIL NIL NIL))
|
||||
(BODYSTRUCTURE ((("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL)("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0 NIL NIL NIL NIL) "mixed" ("boundary" "child") NIL NIL NIL)("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0 NIL NIL NIL NIL) "mixed" ("boundary" "parent") NIL NIL NIL))
|
|
@ -14,11 +14,9 @@ Hello 1
|
|||
Content-Type: text/plain; charset="us-ascii"
|
||||
|
||||
Hello 2
|
||||
|
||||
--child--
|
||||
--parent
|
||||
Content-Type: text/plain; charset="us-ascii"
|
||||
|
||||
Hello 3
|
||||
|
||||
--parent--
|
||||
|
|
|
@ -1 +1 @@
|
|||
(BODY ((("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1) ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1) "mixed") ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1) "mixed"))
|
||||
(BODY ((("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1) ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 7 1) "mixed") ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 7 1) "mixed"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE ((("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1 NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1 NIL NIL NIL NIL) "mixed" ("boundary" "child") NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1 NIL NIL NIL NIL) "mixed" ("boundary" "parent") NIL NIL NIL))
|
||||
(BODYSTRUCTURE ((("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1 NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 7 1 NIL NIL NIL NIL) "mixed" ("boundary" "child") NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL NIL 7 1 NIL NIL NIL NIL) "mixed" ("boundary" "parent") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 49 1) 4) "MIXED"))
|
||||
(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 49 1) 4) "MIXED"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1 NIL NIL NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 49 1 NIL NIL NIL NIL) 4 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "delim") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0 NIL NIL NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 49 1 NIL NIL NIL NIL) 4 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "delim") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("message" "rfc822" NIL NIL NIL "7bit" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 49 1) 4) "mixed"))
|
||||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0)("message" "rfc822" NIL NIL NIL "7bit" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 49 1) 4) "mixed"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1 NIL NIL NIL NIL)("message" "rfc822" NIL NIL NIL "7bit" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 49 1 NIL NIL NIL NIL) 4 NIL NIL NIL NIL) "mixed" ("boundary" "delim") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0 NIL NIL NIL NIL)("message" "rfc822" NIL NIL NIL "7bit" 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 49 1 NIL NIL NIL NIL) 4 NIL NIL NIL NIL) "mixed" ("boundary" "delim") NIL NIL NIL))
|
|
@ -6,7 +6,6 @@ Subject: Welcome to Aerogramme!!
|
|||
Content-Type: text/plain; charset="us-ascii"
|
||||
|
||||
Hello 1
|
||||
|
||||
--delim
|
||||
Content-Type: message/rfc822
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1) ("message" "rfc822" () NIL NIL NIL 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" () NIL NIL NIL 49 1 NIL NIL NIL NIL) 4) "mixed"))
|
||||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL NIL 7 1) ("message" "rfc822" () NIL NIL NIL 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" () NIL NIL NIL 49 1 NIL NIL NIL NIL) 4) "mixed"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL NIL 9 1 NIL NIL NIL NIL) ("message" "rfc822" () NIL NIL NIL 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" () NIL NIL NIL 49 1 NIL NIL NIL NIL) 4 NIL NIL NIL NIL) "mixed" ("boundary" "delim") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL NIL 7 1 NIL NIL NIL NIL) ("message" "rfc822" () NIL NIL NIL 129 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" () NIL NIL NIL 49 1 NIL NIL NIL NIL) 4 NIL NIL NIL NIL) "mixed" ("boundary" "delim") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY (("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "BASE64" 242 3)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 744 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("TEXT" "PLAIN" ("CHARSET" "utf-16") NIL NIL "QUOTED-PRINTABLE" 231 3)("IMAGE" "GIF" ("NAME" "Book about ") NIL NIL "BASE64" 56) "MIXED") 20) "MIXED"))
|
||||
(BODY (("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "BASE64" 242 3)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 734 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("TEXT" "PLAIN" ("CHARSET" "utf-16") NIL NIL "QUOTED-PRINTABLE" 231 3)("IMAGE" "GIF" ("NAME" "Book about coffe tables.gif") NIL NIL "BASE64" 56) "MIXED") 20) "MIXED"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "BASE64" 242 3 NIL NIL NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 744 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("TEXT" "PLAIN" ("CHARSET" "utf-16") NIL NIL "QUOTED-PRINTABLE" 231 3 NIL NIL NIL NIL)("IMAGE" "GIF" ("NAME" "Book about ") NIL NIL "BASE64" 56 NIL ("ATTACHMENT" NIL) NIL NIL) "MIXED" ("BOUNDARY" "giddyup") NIL NIL NIL) 20 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "festivus") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "BASE64" 242 3 NIL NIL NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 734 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("TEXT" "PLAIN" ("CHARSET" "utf-16") NIL NIL "QUOTED-PRINTABLE" 231 3 NIL NIL NIL NIL)("IMAGE" "GIF" ("NAME" "Book about coffe tables.gif") NIL NIL "BASE64" 56 NIL ("ATTACHMENT" NIL) NIL NIL) "MIXED" ("BOUNDARY" "giddyup") NIL NIL NIL) 20 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "festivus") NIL NIL NIL))
|
|
@ -1 +1 @@
|
|||
(BODY (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 3)("message" "rfc822" NIL NIL NIL "7bit" 744 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 3)("image" "gif" ("name*" "''Book about utf-8''%e2%98%95") NIL NIL "Base64" 56) "mixed") 20) "mixed"))
|
||||
(BODY (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 3)("message" "rfc822" NIL NIL NIL "7bit" 734 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 3)("image" "gif" ("name" "Book about coffe tables.gif") NIL NIL "Base64" 56) "mixed") 20) "mixed"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 3 NIL NIL NIL NIL)("message" "rfc822" NIL NIL NIL "7bit" 744 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 3 NIL NIL NIL NIL)("image" "gif" ("name*" "''Book about utf-8''%e2%98%95") NIL NIL "Base64" 56 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "giddyup") NIL NIL NIL) 20 NIL NIL NIL NIL) "mixed" ("boundary" "festivus") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 3 NIL NIL NIL NIL)("message" "rfc822" NIL NIL NIL "7bit" 734 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 3 NIL NIL NIL NIL)("image" "gif" ("name" "Book about coffe tables.gif") NIL NIL "Base64" 56 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "giddyup") NIL NIL NIL) 20 NIL NIL NIL NIL) "mixed" ("boundary" "festivus") NIL NIL NIL))
|
|
@ -2,7 +2,7 @@ From: Art Vandelay <art@vandelay.com> (Vandelay Industries)
|
|||
To: "Colleagues": "James Smythe" <james@vandelay.com>; Friends:
|
||||
jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= <john@example.com>;
|
||||
Date: Sat, 20 Nov 2021 14:22:01 -0800
|
||||
Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?=
|
||||
Subject: Why not both importing AND exporting?
|
||||
Content-Type: multipart/mixed; boundary="festivus";
|
||||
|
||||
--festivus
|
||||
|
@ -30,7 +30,7 @@ Content-Transfer-Encoding: quoted-printable
|
|||
=DD5=D8=1E=DD5=D80=DD5=D8"=DD!=00
|
||||
--giddyup
|
||||
Content-Type: image/gif; name*1="about "; name*0="Book ";
|
||||
name*2*=utf-8''%e2%98%95 tables.gif
|
||||
name*2="coffe tables.gif"
|
||||
Content-Transfer-Encoding: Base64
|
||||
Content-Disposition: attachment
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
(BODY (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 4) ("message" "rfc822" () NIL NIL NIL 742 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 4 NIL NIL NIL NIL) ("text" "plain" () NIL NIL "Base64" 56 1 NIL ("attachment" ()) NIL NIL) "mixed" ("boundary" "giddyup") NIL NIL NIL) 21) "mixed"))
|
||||
(BODY (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 4) ("message" "rfc822" () NIL NIL NIL 732 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 4 NIL NIL NIL NIL) ("image" "gif" ("name" "Book about coffe tables.gif") NIL NIL "Base64" 56 NIL ("attachment" ()) NIL NIL) "mixed" ("boundary" "giddyup") NIL NIL NIL) 21) "mixed"))
|
|
@ -1 +1 @@
|
|||
(BODYSTRUCTURE (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 4 NIL NIL NIL NIL) ("message" "rfc822" () NIL NIL NIL 742 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 4 NIL NIL NIL NIL) ("text" "plain" () NIL NIL "Base64" 56 1 NIL ("attachment" ()) NIL NIL) "mixed" ("boundary" "giddyup") NIL NIL NIL) 21 NIL NIL NIL NIL) "mixed" ("boundary" "festivus") NIL NIL NIL))
|
||||
(BODYSTRUCTURE (("text" "html" ("charset" "us-ascii") NIL NIL "base64" 242 4 NIL NIL NIL NIL) ("message" "rfc822" () NIL NIL NIL 732 (NIL "Exporting my book about coffee tables" (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) (("Cosmo Kramer" NIL "kramer" "kramerica.com")) NIL NIL NIL NIL NIL) (("text" "plain" ("charset" "utf-16") NIL NIL "quoted-printable" 231 4 NIL NIL NIL NIL) ("image" "gif" ("name" "Book about coffe tables.gif") NIL NIL "Base64" 56 NIL ("attachment" ()) NIL NIL) "mixed" ("boundary" "giddyup") NIL NIL NIL) 21 NIL NIL NIL NIL) "mixed" ("boundary" "festivus") NIL NIL NIL))
|
|
@ -0,0 +1 @@
|
|||
(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0) "ALTERNATIVE"))
|
|
@ -0,0 +1 @@
|
|||
(BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0 NIL NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "festivus") NIL NIL NIL))
|
|
@ -0,0 +1 @@
|
|||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0) "alternative"))
|
|
@ -0,0 +1 @@
|
|||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL))
|
|
@ -0,0 +1,10 @@
|
|||
From: Garage team <garagehq@deuxfleurs.fr>
|
||||
Content-Type: multipart/alternative; boundary="festivus";
|
||||
Subject: Welcome to Aerogramme!!
|
||||
|
||||
--festivus
|
||||
Content-Type: text/plain; charset="us-ascii"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Hello 1
|
||||
--festivus--
|
|
@ -0,0 +1 @@
|
|||
(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 1) "alternative"))
|
|
@ -0,0 +1 @@
|
|||
(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 1 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL))
|
|
@ -0,0 +1 @@
|
|||
(BODY (("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 127 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 47 0) 3) "MIXED"))
|
|
@ -0,0 +1 @@
|
|||
(BODYSTRUCTURE (("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 127 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 47 0 NIL NIL NIL NIL) 3 NIL NIL NIL NIL) "MIXED" ("BOUNDARY" "delim") NIL NIL NIL))
|
|
@ -0,0 +1 @@
|
|||
(BODY (("message" "rfc822" NIL NIL NIL "7bit" 127 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 47 0) 3) "mixed"))
|
|
@ -0,0 +1 @@
|
|||
(BODYSTRUCTURE (("message" "rfc822" NIL NIL NIL "7bit" 127 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 47 0 NIL NIL NIL NIL) 3 NIL NIL NIL NIL) "mixed" ("boundary" "delim") NIL NIL NIL))
|
|
@ -0,0 +1,12 @@
|
|||
From: Garage team <garagehq@deuxfleurs.fr>
|
||||
Content-Type: multipart/mixed; boundary="delim";
|
||||
Subject: Welcome to Aerogramme!!
|
||||
|
||||
--delim
|
||||
Content-Type: message/rfc822
|
||||
|
||||
From: Garage team <garagehq@deuxfleurs.fr>
|
||||
Subject: Welcome to Aerogramme!!
|
||||
|
||||
This is just a test email, feel free to ignore.
|
||||
--delim--
|
|
@ -0,0 +1 @@
|
|||
(BODY (("message" "rfc822" () NIL NIL NIL 127 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" () NIL NIL NIL 47 1 NIL NIL NIL NIL) 5) "mixed"))
|
|
@ -0,0 +1 @@
|
|||
(BODYSTRUCTURE (("message" "rfc822" () NIL NIL NIL 127 (NIL "Welcome to Aerogramme!!" (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) (("Garage team" NIL "garagehq" "deuxfleurs.fr")) NIL NIL NIL NIL NIL) ("text" "plain" () NIL NIL NIL 47 1 NIL NIL NIL NIL) 5 NIL NIL NIL NIL) "mixed" ("boundary" "delim") NIL NIL NIL))
|
|
@ -5,56 +5,11 @@ import sys
|
|||
|
||||
# COMMAND USAGE
|
||||
#
|
||||
# start a test IMAP server locally (see comment below)
|
||||
# start a test IMAP servers:
|
||||
# docker-compose.up
|
||||
# then call this script. eg:
|
||||
# ./send-to-imap.py dovecot ./emails/dxflrs/
|
||||
# ./send-to-imap.py all ./emails/dxflrs/
|
||||
|
||||
# DOCKER CONTAINERS TO QUICKLY SPAWN A REFERENCE SERVER
|
||||
#
|
||||
# -- Dovecot --
|
||||
# cmd: docker run --rm -it -p 993:993 -p 143:143 dovecot/dovecot
|
||||
# user: test (any)
|
||||
# pw: pass
|
||||
#
|
||||
# -- Maddy --
|
||||
# cmds:
|
||||
# docker volume create maddydata
|
||||
# openssl req -nodes -new -x509 -keyout privkey.pem -out fullchain.pem
|
||||
# docker run --rm -it --name maddy -e MADDY_DOMAIN=example.com -e MADDY_HOSTNAME=mx.example.com -v maddydata:/data -p 143:143 -p 993:993 --entrypoint /bin/sh foxcpp/maddy
|
||||
# mkdir /data/tls
|
||||
# docker cp ./fullchain.pem maddy:/data/tls/
|
||||
# docker cp ./privkey.pem maddy:/data/tls/
|
||||
# maddyctl creds create test@example.com
|
||||
# maddyctl imap-acct create test@example.com
|
||||
# maddy -config /data/maddy.conf run --debug
|
||||
#
|
||||
# docker run --rm -it -v maddydata:/data-p 143:143 -p 993:993 foxcpp/maddy
|
||||
#
|
||||
# -- Cyrus --
|
||||
# docker run --rm -it --name cyrus -v /dev/log:/dev/log -p 143:143 -p 993:993 debian:buster
|
||||
# apt update; apt install -y cyrus-imapd cyrus-pop3d cyrus-nntpd cyrus-caldav cyrus-admin sasl2-bin vim
|
||||
# # ( 1. No Configuration / 8. Europe / 37. Paris / yes)
|
||||
# vim /etc/imapd.conf
|
||||
# # (uncomment 'admins: cyrus')
|
||||
# touch /var/lib/cyrus/tls_sessions.db
|
||||
# chown cyrus:mail /var/lib/cyrus/tls_sessions.db
|
||||
# mkdir /run/cyrus
|
||||
# chown -R cyrus:mail /run/cyrus
|
||||
# cyrmaster -D -l 32 -C /etc/imapd.conf -M /etc/cyrus.conf
|
||||
# docker exec -ti --name cyrus /bin/bash
|
||||
# saslpasswd2 cyrus
|
||||
# # (put "cyrus" as password)
|
||||
# saslpasswd2 test
|
||||
# # (put "pass" as password)
|
||||
# cyradm -u cyrus localhost
|
||||
# cm kzUXL7HyS5OjLcU8
|
||||
# setaclmailbox kzUXL7HyS5OjLcU8 test ktelrswip
|
||||
#
|
||||
# -> note, must be run between 2 send-imap commands in cyradm
|
||||
# localhost> setaclmailbox kzUXL7HyS5OjLcU8 cyrus x
|
||||
# localhost> dm kzUXL7HyS5OjLcU8
|
||||
# localhost> cm kzUXL7HyS5OjLcU8
|
||||
# localhost> setaclmailbox kzUXL7HyS5OjLcU8 test ktelrswip
|
||||
|
||||
def rebuild_body_res(b):
|
||||
bb = b''
|
||||
|
@ -67,35 +22,49 @@ def rebuild_body_res(b):
|
|||
f = bb[bb.find(b'('):]
|
||||
return f
|
||||
|
||||
target = sys.argv[1]
|
||||
mode = sys.argv[1]
|
||||
path = sys.argv[2]
|
||||
|
||||
base_test_mb = "kzUXL7HyS5OjLcU8"
|
||||
parameters = {
|
||||
"dovecot": {
|
||||
"con": IMAP4_SSL,
|
||||
"port": 993,
|
||||
"user": "test",
|
||||
"pw": "pass",
|
||||
"ext": ".dovecot",
|
||||
"mb": base_test_mb,
|
||||
},
|
||||
"maddy": {
|
||||
"con": IMAP4_SSL,
|
||||
"port": 994,
|
||||
"user": "test@example.com",
|
||||
"pw": "pass",
|
||||
"ext": ".maddy",
|
||||
"mb": base_test_mb,
|
||||
},
|
||||
"cyrus": {
|
||||
"con": IMAP4,
|
||||
"port": 143,
|
||||
"user": "test",
|
||||
"pw": "pass",
|
||||
"ext": ".cyrus",
|
||||
"mb": "INBOX."+base_test_mb,
|
||||
}
|
||||
}
|
||||
conf = parameters[target]
|
||||
|
||||
queue = list(parameters.keys())
|
||||
if mode in parameters:
|
||||
queue = [ mode ]
|
||||
|
||||
onlyfiles = [join(path, f) for f in listdir(path) if isfile(join(path, f)) and len(f) > 4 and f[-4:] == ".eml"]
|
||||
|
||||
test_mb = "kzUXL7HyS5OjLcU8"
|
||||
with conf['con'](host="localhost") as M:
|
||||
for target in queue:
|
||||
print(f"--- {target} ---")
|
||||
conf = parameters[target]
|
||||
test_mb = conf['mb']
|
||||
|
||||
with conf['con'](host="localhost", port=conf['port']) as M:
|
||||
print(M.login(conf['user'], conf['pw']))
|
||||
print(M.delete(test_mb))
|
||||
print(M.create(test_mb))
|
||||
|
|
Loading…
Reference in New Issue