aboutsummaryrefslogtreecommitdiff
path: root/src/mail_parser_tests.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-15 16:15:48 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-15 16:15:48 +0200
commit24c6607304323f0dd3c70bf952bfc5775735ca70 (patch)
tree824cd15d393d38f69f8d4fd8cfb5fa7921ee69ee /src/mail_parser_tests.rs
parent64a322b4cb11a73c2da5f1a44649384a16b3ee2b (diff)
downloadaerogramme-24c6607304323f0dd3c70bf952bfc5775735ca70.tar.gz
aerogramme-24c6607304323f0dd3c70bf952bfc5775735ca70.zip
Some more FETCH things work
Diffstat (limited to 'src/mail_parser_tests.rs')
-rw-r--r--src/mail_parser_tests.rs181
1 files changed, 181 insertions, 0 deletions
diff --git a/src/mail_parser_tests.rs b/src/mail_parser_tests.rs
new file mode 100644
index 0000000..56e394f
--- /dev/null
+++ b/src/mail_parser_tests.rs
@@ -0,0 +1,181 @@
+use mail_parser::Message;
+
+#[test]
+fn test1() {
+ let input = br#"Content-Type: multipart/mixed; boundary="1234567890123456789012345678901234567890123456789012345678901234567890123456789012"
+
+--1234567890123456789012345678901234567890123456789012345678901234567890123456789012
+Content-Type: multipart/mixed; boundary="123456789012345678901234567890123456789012345678901234567890123456789012345678901"
+
+--123456789012345678901234567890123456789012345678901234567890123456789012345678901
+Content-Type: multipart/mixed; boundary="12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+
+--12345678901234567890123456789012345678901234567890123456789012345678901234567890
+Content-Type: text/plain
+
+1
+--1234567890123456789012345678901234567890123456789012345678901234567890123456789012
+Content-Type: text/plain
+
+22
+--123456789012345678901234567890123456789012345678901234567890123456789012345678901
+Content-Type: text/plain
+
+333
+--12345678901234567890123456789012345678901234567890123456789012345678901234567890
+Content-Type: text/plain
+
+4444
+"#;
+
+ let message = Message::parse(input);
+ dbg!(message);
+}
+
+#[test]
+fn test2() {
+ let input = br#"Message-ID: <39235E1C.1DC7EA90@example.com>
+Date: Wed, 17 May 2000 23:06:04 -0400
+From: Doug Sauder <dwsauder@example.com>
+X-Mailer: Mozilla 4.7 [en] (WinNT; I)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: Joe Blow <blow@example.com>
+Subject: Test message from Netscape Communicator 4.7
+Content-Type: multipart/mixed;
+ boundary="------------A1FCDEE154E03D875E5D6779"
+
+This is a multi-part message in MIME format.
+--------------A1FCDEE154E03D875E5D6779
+Content-Type: text/plain; charset=iso-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+Die Hasen und die Fr=F6sche
+
+Die Hasen klagten einst =FCber ihre mi=DFliche Lage; "wir leben", sprach =
+ein
+Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,
+der Adler, ja fast aller Raubtiere! Unsere stete Angst ist =E4rger als de=
+r
+Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."
+
+In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;
+allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt
+erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie=
+ aufs
+schnellste untertauchten.
+
+"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ei=
+n
+wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,
+welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
+
+
+
+--------------A1FCDEE154E03D875E5D6779
+Content-Type: image/png;
+ name="redball.png"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline;
+ filename="redball.png"
+
+iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAV
+AAAaAAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACH
+AAB9AAB0AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABb
+AAAuAAAIAABMAAB3AACZAAC0GRnKODjVPT3bK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P5ni4wKio6JjYtPSExKTnFW
+SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2Yn
+OAj+d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/
+uXLzVJ2qm6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW
+0g0bN63crGqVtWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36Kw
+bNmRo7O3zpHkPSZwHBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8
+YVOlI+CJ4/9/joOyYed5QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms
+1y9evXid7QZacgOxmSxktNzdtSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21t
+ZW50AGNsaXAyZ2lmIHYuMC42IGJ5IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
+--------------A1FCDEE154E03D875E5D6779
+Content-Type: image/png;
+ name="greenball.png"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline;
+ filename="greenball.png"
+
+iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAAAEAAAGAAA
+IQAACAAAMQAAQgAAUgAAWgAASgAIYwAIcwAIewAQjAAIawAAOQAAYwAQlAAQnAAhpQAQpQAh
+rQBCvRhjxjFjxjlSxiEpzgAYvQAQrQAYrQAhvQCU1mOt1nuE1lJK3hgh1gAYxgAYtQAAKQBC
+zhDO55Te563G55SU52NS5yEh3gAYzgBS3iGc52vW75y974yE71JC7xCt73ul3nNa7ykh5wAY
+1gAx5wBS7yFr7zlK7xgp5wAp7wAx7wAIhAAQtQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAA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3kAWZ9Pr55fH18XSmRuKUTXUaqHy7O19tfr4NFle/w3YDrWRUIlZrL/W86XJkyJV
+G9EaEjIx2XyZmZJGioeUaL+2AY8TY8omR6nkLKhu70zjUKVJXsp3quS2DVSJWNh3zzJKCyex
+I0ZxBP3afE0ElyqOlZJyw8r3BE2SFiJCyxA434SCkg65RhdeQBljQtCg39LWrA90RDDG1EWr
+YUO23hMANUKRRl61E529cR++D2G5LK002dr/qrcfu9u0V3bxn/XdhR/NYeeN0ggsLAAAACV0
+RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5C
+YII=
+--------------A1FCDEE154E03D875E5D6779
+Content-Type: image/png;
+ name="blueball.png"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline;
+ filename="blueball.png"
+
+iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgA
+AAAACCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQ
+MZQAGFIQMYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYY
+QsYQMaUAACHO5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9K
+e+8YOaUYSsaMvee15++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAA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AZg40J3+Xtbv1rgOAZwG0N
+xW62p+lT+Yi747sD/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBi
+eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
+--------------A1FCDEE154E03D875E5D6779--
+"#;
+
+ let message = Message::parse(input).unwrap();
+ //dbg!(&message);
+ let part = message.parts.get(0).unwrap();
+ //dbg!(&part);
+ let part_msg = part.parse_message().unwrap();
+}