aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-07-08 11:47:59 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-07-08 11:47:59 +0200
commite72985a38cec9e31eb2c4b6fa012895ff07226a8 (patch)
tree02bb1f8b19781d61c27734a0f891e7e291f3a0be /tests
parent9675cdb545a139984a2d765397f3a5e26472a49e (diff)
downloadaerogramme-e72985a38cec9e31eb2c4b6fa012895ff07226a8.tar.gz
aerogramme-e72985a38cec9e31eb2c4b6fa012895ff07226a8.zip
Add a docker-compose spawning Dovecot+Cyrus+Maddy
Diffstat (limited to 'tests')
-rw-r--r--tests/README.md21
-rw-r--r--tests/docker-compose.yml22
-rw-r--r--tests/docker/cyrus/Dockerfile15
-rwxr-xr-xtests/docker/cyrus/entrypoint.sh15
-rw-r--r--tests/docker/maddy/Dockerfile16
-rwxr-xr-xtests/docker/maddy/entrypoint.sh9
-rw-r--r--tests/emails/dxflrs/0002_mime.cyrus.body2
-rw-r--r--tests/emails/dxflrs/0002_mime.cyrus.bodystructure2
-rw-r--r--tests/emails/dxflrs/0002_mime.dovecot.body2
-rw-r--r--tests/emails/dxflrs/0002_mime.dovecot.bodystructure2
-rw-r--r--tests/emails/dxflrs/0002_mime.eml1
-rw-r--r--tests/emails/dxflrs/0002_mime.maddy.body2
-rw-r--r--tests/emails/dxflrs/0002_mime.maddy.bodystructure2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.cyrus.body2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.cyrus.bodystructure2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.dovecot.body2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.dovecot.bodystructure2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.eml2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.maddy.body2
-rw-r--r--tests/emails/dxflrs/0003_mime-in-mime.maddy.bodystructure2
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.cyrus.body2
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.cyrus.bodystructure2
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.dovecot.body2
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.dovecot.bodystructure2
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.eml1
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.maddy.body2
-rw-r--r--tests/emails/dxflrs/0004_msg-in-msg.maddy.bodystructure2
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.cyrus.body2
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.cyrus.bodystructure2
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.dovecot.body2
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.dovecot.bodystructure2
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.eml4
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.maddy.body2
-rw-r--r--tests/emails/dxflrs/0005_mail-parser-readme.maddy.bodystructure2
-rw-r--r--tests/emails/dxflrs/0006_single-mime.cyrus.body1
-rw-r--r--tests/emails/dxflrs/0006_single-mime.cyrus.bodystructure1
-rw-r--r--tests/emails/dxflrs/0006_single-mime.dovecot.body1
-rw-r--r--tests/emails/dxflrs/0006_single-mime.dovecot.bodystructure1
-rw-r--r--tests/emails/dxflrs/0006_single-mime.eml10
-rw-r--r--tests/emails/dxflrs/0006_single-mime.maddy.body1
-rw-r--r--tests/emails/dxflrs/0006_single-mime.maddy.bodystructure1
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.body1
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.bodystructure1
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.body1
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.bodystructure1
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.eml12
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.body1
-rw-r--r--tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.bodystructure1
-rw-r--r--tests/send-to-imap.py127
49 files changed, 206 insertions, 109 deletions
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..e2bfa6b
--- /dev/null
+++ b/tests/README.md
@@ -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`
diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml
new file mode 100644
index 0000000..6a112bb
--- /dev/null
+++ b/tests/docker-compose.yml
@@ -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"
diff --git a/tests/docker/cyrus/Dockerfile b/tests/docker/cyrus/Dockerfile
new file mode 100644
index 0000000..67b4e11
--- /dev/null
+++ b/tests/docker/cyrus/Dockerfile
@@ -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" ]
+
diff --git a/tests/docker/cyrus/entrypoint.sh b/tests/docker/cyrus/entrypoint.sh
new file mode 100755
index 0000000..c410e9d
--- /dev/null
+++ b/tests/docker/cyrus/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
diff --git a/tests/docker/maddy/Dockerfile b/tests/docker/maddy/Dockerfile
new file mode 100644
index 0000000..341e398
--- /dev/null
+++ b/tests/docker/maddy/Dockerfile
@@ -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" ]
diff --git a/tests/docker/maddy/entrypoint.sh b/tests/docker/maddy/entrypoint.sh
new file mode 100755
index 0000000..f875624
--- /dev/null
+++ b/tests/docker/maddy/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
diff --git a/tests/emails/dxflrs/0002_mime.cyrus.body b/tests/emails/dxflrs/0002_mime.cyrus.body
index 266e647..1a3e7e5 100644
--- a/tests/emails/dxflrs/0002_mime.cyrus.body
+++ b/tests/emails/dxflrs/0002_mime.cyrus.body
@@ -1 +1 @@
-(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "8BIT" 16 1) "ALTERNATIVE")) \ No newline at end of file
+(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 9 1)("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "8BIT" 14 0) "ALTERNATIVE")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0002_mime.cyrus.bodystructure b/tests/emails/dxflrs/0002_mime.cyrus.bodystructure
index ea386b6..2562f5a 100644
--- a/tests/emails/dxflrs/0002_mime.cyrus.bodystructure
+++ b/tests/emails/dxflrs/0002_mime.cyrus.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0002_mime.dovecot.body b/tests/emails/dxflrs/0002_mime.dovecot.body
index a6c1dd9..061267d 100644
--- a/tests/emails/dxflrs/0002_mime.dovecot.body
+++ b/tests/emails/dxflrs/0002_mime.dovecot.body
@@ -1 +1 @@
-(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("text" "html" ("charset" "utf-8") NIL NIL "8bit" 16 1) "alternative")) \ No newline at end of file
+(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1)("text" "html" ("charset" "utf-8") NIL NIL "8bit" 14 0) "alternative")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0002_mime.dovecot.bodystructure b/tests/emails/dxflrs/0002_mime.dovecot.bodystructure
index 1dce36b..1b61c91 100644
--- a/tests/emails/dxflrs/0002_mime.dovecot.bodystructure
+++ b/tests/emails/dxflrs/0002_mime.dovecot.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0002_mime.eml b/tests/emails/dxflrs/0002_mime.eml
index c03e037..fc67f75 100644
--- a/tests/emails/dxflrs/0002_mime.eml
+++ b/tests/emails/dxflrs/0002_mime.eml
@@ -13,5 +13,4 @@ Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit
<p>Hello 2</p>
-
--festivus--
diff --git a/tests/emails/dxflrs/0002_mime.maddy.body b/tests/emails/dxflrs/0002_mime.maddy.body
index 8c8758c..c3e64e9 100644
--- a/tests/emails/dxflrs/0002_mime.maddy.body
+++ b/tests/emails/dxflrs/0002_mime.maddy.body
@@ -1 +1 @@
-(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1) ("text" "html" ("charset" "utf-8") NIL NIL "8bit" 16 1) "alternative")) \ No newline at end of file
+(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 9 1) ("text" "html" ("charset" "utf-8") NIL NIL "8bit" 14 1) "alternative")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0002_mime.maddy.bodystructure b/tests/emails/dxflrs/0002_mime.maddy.bodystructure
index 83e6b64..933a301 100644
--- a/tests/emails/dxflrs/0002_mime.maddy.bodystructure
+++ b/tests/emails/dxflrs/0002_mime.maddy.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.cyrus.body b/tests/emails/dxflrs/0003_mime-in-mime.cyrus.body
index c810d09..e4c8581 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.cyrus.body
+++ b/tests/emails/dxflrs/0003_mime-in-mime.cyrus.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.cyrus.bodystructure b/tests/emails/dxflrs/0003_mime-in-mime.cyrus.bodystructure
index 7d4f4ae..5b14834 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.cyrus.bodystructure
+++ b/tests/emails/dxflrs/0003_mime-in-mime.cyrus.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.dovecot.body b/tests/emails/dxflrs/0003_mime-in-mime.dovecot.body
index ddf0f6d..1b091fc 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.dovecot.body
+++ b/tests/emails/dxflrs/0003_mime-in-mime.dovecot.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.dovecot.bodystructure b/tests/emails/dxflrs/0003_mime-in-mime.dovecot.bodystructure
index 903d343..b0de86f 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.dovecot.bodystructure
+++ b/tests/emails/dxflrs/0003_mime-in-mime.dovecot.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.eml b/tests/emails/dxflrs/0003_mime-in-mime.eml
index 52f4e15..3d5c5ff 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.eml
+++ b/tests/emails/dxflrs/0003_mime-in-mime.eml
@@ -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--
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.maddy.body b/tests/emails/dxflrs/0003_mime-in-mime.maddy.body
index 124b66e..6426cc8 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.maddy.body
+++ b/tests/emails/dxflrs/0003_mime-in-mime.maddy.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0003_mime-in-mime.maddy.bodystructure b/tests/emails/dxflrs/0003_mime-in-mime.maddy.bodystructure
index e04a189..8d670f9 100644
--- a/tests/emails/dxflrs/0003_mime-in-mime.maddy.bodystructure
+++ b/tests/emails/dxflrs/0003_mime-in-mime.maddy.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.cyrus.body b/tests/emails/dxflrs/0004_msg-in-msg.cyrus.body
index d02b2e3..1423238 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.cyrus.body
+++ b/tests/emails/dxflrs/0004_msg-in-msg.cyrus.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.cyrus.bodystructure b/tests/emails/dxflrs/0004_msg-in-msg.cyrus.bodystructure
index 939e4fe..d320b42 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.cyrus.bodystructure
+++ b/tests/emails/dxflrs/0004_msg-in-msg.cyrus.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.dovecot.body b/tests/emails/dxflrs/0004_msg-in-msg.dovecot.body
index 9ff3336..067208b 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.dovecot.body
+++ b/tests/emails/dxflrs/0004_msg-in-msg.dovecot.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.dovecot.bodystructure b/tests/emails/dxflrs/0004_msg-in-msg.dovecot.bodystructure
index a0d751a..a85182f 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.dovecot.bodystructure
+++ b/tests/emails/dxflrs/0004_msg-in-msg.dovecot.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.eml b/tests/emails/dxflrs/0004_msg-in-msg.eml
index f581b59..6c97d84 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.eml
+++ b/tests/emails/dxflrs/0004_msg-in-msg.eml
@@ -6,7 +6,6 @@ Subject: Welcome to Aerogramme!!
Content-Type: text/plain; charset="us-ascii"
Hello 1
-
--delim
Content-Type: message/rfc822
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.maddy.body b/tests/emails/dxflrs/0004_msg-in-msg.maddy.body
index c3e0bd3..cc1bf45 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.maddy.body
+++ b/tests/emails/dxflrs/0004_msg-in-msg.maddy.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0004_msg-in-msg.maddy.bodystructure b/tests/emails/dxflrs/0004_msg-in-msg.maddy.bodystructure
index 4ff4ef1..93e32e8 100644
--- a/tests/emails/dxflrs/0004_msg-in-msg.maddy.bodystructure
+++ b/tests/emails/dxflrs/0004_msg-in-msg.maddy.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.body b/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.body
index 1974cd5..3e264ec 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.body
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.bodystructure b/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.bodystructure
index 5189948..1d7b360 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.bodystructure
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.cyrus.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.body b/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.body
index 2d2b350..f1c03df 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.body
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.bodystructure b/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.bodystructure
index e5d0af9..663978f 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.bodystructure
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.dovecot.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.eml b/tests/emails/dxflrs/0005_mail-parser-readme.eml
index 40e4fa2..1a36718 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.eml
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.eml
@@ -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
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.maddy.body b/tests/emails/dxflrs/0005_mail-parser-readme.maddy.body
index 47261da..0341ec3 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.maddy.body
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.maddy.body
@@ -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")) \ No newline at end of file
+(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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0005_mail-parser-readme.maddy.bodystructure b/tests/emails/dxflrs/0005_mail-parser-readme.maddy.bodystructure
index af8c3ce..7cb0c90 100644
--- a/tests/emails/dxflrs/0005_mail-parser-readme.maddy.bodystructure
+++ b/tests/emails/dxflrs/0005_mail-parser-readme.maddy.bodystructure
@@ -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)) \ No newline at end of file
+(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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0006_single-mime.cyrus.body b/tests/emails/dxflrs/0006_single-mime.cyrus.body
new file mode 100644
index 0000000..b7f4fba
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.cyrus.body
@@ -0,0 +1 @@
+(BODY (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0) "ALTERNATIVE")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0006_single-mime.cyrus.bodystructure b/tests/emails/dxflrs/0006_single-mime.cyrus.bodystructure
new file mode 100644
index 0000000..91306a0
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.cyrus.bodystructure
@@ -0,0 +1 @@
+(BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 7 0 NIL NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "festivus") NIL NIL NIL)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0006_single-mime.dovecot.body b/tests/emails/dxflrs/0006_single-mime.dovecot.body
new file mode 100644
index 0000000..1eec263
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.dovecot.body
@@ -0,0 +1 @@
+(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0) "alternative")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0006_single-mime.dovecot.bodystructure b/tests/emails/dxflrs/0006_single-mime.dovecot.bodystructure
new file mode 100644
index 0000000..9409f4c
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.dovecot.bodystructure
@@ -0,0 +1 @@
+(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 0 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0006_single-mime.eml b/tests/emails/dxflrs/0006_single-mime.eml
new file mode 100644
index 0000000..f633348
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.eml
@@ -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--
diff --git a/tests/emails/dxflrs/0006_single-mime.maddy.body b/tests/emails/dxflrs/0006_single-mime.maddy.body
new file mode 100644
index 0000000..1204086
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.maddy.body
@@ -0,0 +1 @@
+(BODY (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 1) "alternative")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0006_single-mime.maddy.bodystructure b/tests/emails/dxflrs/0006_single-mime.maddy.bodystructure
new file mode 100644
index 0000000..26cd1aa
--- /dev/null
+++ b/tests/emails/dxflrs/0006_single-mime.maddy.bodystructure
@@ -0,0 +1 @@
+(BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 7 1 NIL NIL NIL NIL) "alternative" ("boundary" "festivus") NIL NIL NIL)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.body b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.body
new file mode 100644
index 0000000..1126840
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.body
@@ -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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.bodystructure b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.bodystructure
new file mode 100644
index 0000000..0f46513
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.cyrus.bodystructure
@@ -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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.body b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.body
new file mode 100644
index 0000000..b2ac4e8
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.body
@@ -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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.bodystructure b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.bodystructure
new file mode 100644
index 0000000..5903df3
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.dovecot.bodystructure
@@ -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)) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.eml b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.eml
new file mode 100644
index 0000000..af1b576
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.eml
@@ -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--
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.body b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.body
new file mode 100644
index 0000000..70c4983
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.body
@@ -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")) \ No newline at end of file
diff --git a/tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.bodystructure b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.bodystructure
new file mode 100644
index 0000000..60c1a42
--- /dev/null
+++ b/tests/emails/dxflrs/0007_raw_msg_in_rfc822.maddy.bodystructure
@@ -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)) \ No newline at end of file
diff --git a/tests/send-to-imap.py b/tests/send-to-imap.py
index 46a97a6..b707570 100644
--- a/tests/send-to-imap.py
+++ b/tests/send-to-imap.py
@@ -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,65 +22,79 @@ 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:
- print(M.login(conf['user'], conf['pw']))
- print(M.delete(test_mb))
- print(M.create(test_mb))
+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))
- print(M.list())
- print(M.select(test_mb))
- failed = 0
- for (idx, f) in enumerate(onlyfiles):
- f_noext = f[:-4]
- try:
- with open(f, 'r+b') as mail:
- print(M.append(test_mb, [], None, mail.read()))
- seq = (f"{idx+1-failed}:{idx+1-failed}").encode()
- (r, b) = M.fetch(seq, "(BODY)")
- print((r, b))
- assert r == 'OK'
+ print(M.list())
+ print(M.select(test_mb))
+ failed = 0
+ for (idx, f) in enumerate(onlyfiles):
+ f_noext = f[:-4]
+ try:
+ with open(f, 'r+b') as mail:
+ print(M.append(test_mb, [], None, mail.read()))
+ seq = (f"{idx+1-failed}:{idx+1-failed}").encode()
+ (r, b) = M.fetch(seq, "(BODY)")
+ print((r, b))
+ assert r == 'OK'
- with open(f_noext + conf['ext'] + ".body", 'w+b') as w:
- w.write(rebuild_body_res(b))
+ with open(f_noext + conf['ext'] + ".body", 'w+b') as w:
+ w.write(rebuild_body_res(b))
- (r, b) = M.fetch(seq, "(BODYSTRUCTURE)")
- print((r, b))
- assert r == 'OK'
- with open(f_noext + conf['ext'] + ".bodystructure", 'w+b') as w:
- w.write(rebuild_body_res(b))
- except:
- failed += 1
- print(f"failed {f}")
+ (r, b) = M.fetch(seq, "(BODYSTRUCTURE)")
+ print((r, b))
+ assert r == 'OK'
+ with open(f_noext + conf['ext'] + ".bodystructure", 'w+b') as w:
+ w.write(rebuild_body_res(b))
+ except:
+ failed += 1
+ print(f"failed {f}")
- M.close()
- M.logout()
+ M.close()
+ M.logout()