Skip to content

Instantly share code, notes, and snippets.

@marklogic
Created April 16, 2010 00:24
Show Gist options
  • Save marklogic/367839 to your computer and use it in GitHub Desktop.
Save marklogic/367839 to your computer and use it in GitHub Desktop.
# Example encoding of an email message in JSON
{
headers: [ # in an array since order matters
{ name: 'Subject', value: 'An email' },
{ name: 'Date', value: 'Thu, 4 Mar 2010 15:35:32 -0800' },
{ name: 'From', value: '[email protected]' },
{ name: 'To', value: '[email protected]' }
{ name: 'Sender', value: '[email protected]' }
{ name: 'Reply-to', value: '[email protected]' }
],
from: 'From blah blah...',
body: {
type: 'multipart/alternative,
parts: [
{
id: 'partid-1',
type: 'text/plain',
sections: [
{
type: 'greeting',
text: 'Dear Jason,'
},
{
type: 'normal',
text: ["This is an ", {type: 'url', href: 'http://foo.com, text: "URL"}, ", that I have embedded in some text."]
},
{
type: quoted-section,
text: "Something worth quoting."
},
{
type: quoted-section,
body: {
headers: [
{ name: 'Subject', value: 'Hey there' },
{ name: 'Date', ... }
],
body: {
type: 'text/plain',
text: 'Hi there'
}
}
},
{
type: 'signature',
text: '...'
}
]
},
{
id: 'id',
type: 'text/html'
text: '<bold>Dear Jason</bold>, <br/>This is a test.',
},
]
}
}
@Channelmiddle
Copy link

Example encoding of an email message in JSON { headers: [ # in an array since order matters { name: 'Subject', value: 'An email' }, { name: 'Date', value: 'Thu, 4 Mar 2010 15:35:32 -0800' }, { name: 'From', value: '[email protected]' }, { name: 'To', value: '[email protected]' } { name: 'Sender', value: '[email protected]' } { name: 'Reply-to', value: '[email protected]' } ], from: 'From blah blah...', body: { type: 'multipart/alternative, parts: [ { id: 'partid-1', type: 'text/plain', sections: [ { type: 'greeting', text: 'Dear Jason,' }, { type: 'normal', text: ["This is an ", {type: 'url', href: 'http://foo.com, text: "URL"}, ", that I have embedded in some text."] }, { type: quoted-section, text: "Something worth quoting." }, { type: quoted-section, body: { headers: [ { name: 'Subject', value: 'Hey there' }, { name: 'Date', ... } ], body: { type: 'text/plain', text: 'Hi there' } } }, { type: 'signature', text: '...' } ] }, { id: 'id', type: 'text/html' text: 'Dear Jason,
This is a test.', }, ] } }

@Channelmiddle
Copy link

# Example encoding of an email message in JSON { headers: [ # in an array since order matters { name: 'Subject', value: 'An email' }, { name: 'Date', value: 'Thu, 4 Mar 2010 15:35:32 -0800' }, { name: 'From', value: '[email protected]' }, { name: 'To', value: '[email protected]' } { name: 'Sender', value: '[email protected]' } { name: 'Reply-to', value: '[email protected]' } ], from: 'From blah blah...', body: { type: 'multipart/alternative, parts: [ { id: 'partid-1', type: 'text/plain', sections: [ { type: 'greeting', text: 'Dear Jason,' }, { type: 'normal', text: ["This is an ", {type: 'url', href: 'http://foo.com, text: "URL"}, ", that I have embedded in some text."] }, { type: quoted-section, text: "Something worth quoting." }, { type: quoted-section, body: { headers: [ { name: 'Subject', value: 'Hey there' }, { name: 'Date', ... } ], body: { type: 'text/plain', text: 'Hi there' } } }, { type: 'signature', text: '...' } ] }, { id: 'id', type: 'text/html' text: '<bold>Dear Jason</bold>, <br/>This is a test.', }, ] } }

@Channelmiddle
Copy link

Example encoding of an email message in JSON { headers: [ # in an array since order matters { name: 'Subject', value: 'An email' }, { name: 'Date', value: 'Thu, 4 Mar 2010 15:35:32 -0800' }, { name: 'From', value: '[email protected]' }, { name: 'To', value: '[email protected]' } { name: 'Sender', value: '[email protected]' } { name: 'Reply-to', value: '[email protected]' } ], from: 'From blah blah...', body: { type: 'multipart/alternative, parts: [ { id: 'partid-1', type: 'text/plain', sections: [ { type: 'greeting', text: 'Dear Jason,' }, { type: 'normal', text: ["This is an ", {type: 'url', href: 'http://foo.com, text: "URL"}, ", that I have embedded in some text."] }, { type: quoted-section, text: "Something worth quoting." }, { type: quoted-section, body: { headers: [ { name: 'Subject', value: 'Hey there' }, { name: 'Date', ... } ], body: { type: 'text/plain', text: 'Hi there' } } }, { type: 'signature', text: '...' } ] }, { id: 'id', type: 'text/html' text: 'Dear Jason,
This is a test.', }, ] } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment