drewr/postal — Issue #13: Message format
Author: pepijndevos
Created: 2011-11-23 11:13:57+00:00
State: open

I'm working on an IMAP wrapper that I'd like to integrate with Postal later on, but there are a few incompatibilities or inconsistencies.

For a multipart message, you suggest

{:from "me@draines.com"
:to "foo@example.com"
:subject "Hi!"
:body [{:type "text/html"
:content "Test!"}
;;;; supports both dispositions:
{:type :attachment
:content (java.io.File. "/tmp/foo.txt")}
{:type :inline
:content (java.io.File. "/tmp/foo.txt")}]}

This is almost equal to what I produce, except that you use both :content and :body, and :type for both :content-type and :content-disposition, why? Are they interchangeable, or is there a difference?

An example message of mine, which is a rather straightforward conversion:

{:subject "anther test",
:from "Pepijn de Vos ",
:date "Thu, 17 Nov 2011 17:28:50 +0100",
:to "postmaster@wishfulcoding.mailgun.org",
:content
({:content "Hi\r\n\r\n",
:content-type "text/plain; charset=\"us-ascii\"",
:mime-version "1.0",
:content-transfer-encoding "7bit"}
{:content
({:content
"

Hi

",
:content-type "text/html; charset=\"us-ascii\"",
:mime-version "1.0",
:content-transfer-encoding "7bit"}
{:content
#,
:content-type "image/png; name=\"illusion.png\"",
:mime-version "1.0",
:content-id "<02374C7B-D4AB-4D39-A892-8FC5B025A9EF@lan>",
:content-disposition "inline; filename=\"illusion.png\"",
:content-transfer-encoding "base64"}
{:content
#,
:content-type "image/png; name=\"square.png\"",
:mime-version "1.0",
:content-id "",
:content-disposition "inline; filename=\"square.png\"",
:content-transfer-encoding "base64"}),
:content-type
"multipart/related;\r\n boundary=\"===============7617467129600379649==\"",
:mime-version "1.0"}),
:received
"from ubuntu.lan (ip4da451b5.direct-adsl.nl. [77.164.81.181]) by\r\n mx.google.com with ESMTPS id f41sm91056321eec.5.2011.11.17.08.28.50\r\n (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 08:28:53 -0800 (PST)",
:content-type
"multipart/alternative;\r\n boundary=\"===============4025336257788734124==\"",
:mime-version "1.0",
:dkim-signature
"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r\n h=from:content-type:subject:date:message-id:to:mime-version:x-mailer;\r\n bh=aHrYvWBg8oYhUws6PWTTAvMs9wUsBG0OfADodtVoP40=;\r\n b=TH+x17rro680gVsA0e5numk5JiOJPnaYCNafeN4ubkJCG3r5y4Ttk2xw+cN35wqaop\r\n zeqO1RcRfVWXozquGNIWa6Xo7E/JPSvH62jnionnrnZU7qN2Vyr0SIFwZWcCFMR5Wxkd\r\n 0JqJLT4hbQ+W1HM+W5AGTGntYNDw7OfDG7emI=",
:message-id "",
:x-mailer "Apple Mail (2.1251.1)"}