synapsestudios / hapi-email-kue

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Documentation #7

Open baohx2000 opened 8 years ago

baohx2000 commented 8 years ago

What's an emailObject look like?

spruce-bruce commented 8 years ago

Yeah - one more for the todo list.

I think that the email object will end up being driver specific. Like if you're using the mandrill driver then you use the mandrill object, etc. I like that because there's no BS object mutation that has to happen, but kind of confusing that this works with multiple objects.

My thought is that the drivers should be split out into their own packages and passed in as options on the hapi plugin. So the documentation for the email object to use will be on those individual packages. Right now the only driver is the mandrill driver right in this package and the email object it expects is the mandrill object which looks like this:

var message = {
    "html": "<p>Example HTML content</p>",
    "text": "Example text content",
    "subject": "example subject",
    "from_email": "message.from_email@example.com",
    "from_name": "Example Name",
    "to": [{
            "email": "recipient.email@example.com",
            "name": "Recipient Name",
            "type": "to"
        }],
    "headers": {
        "Reply-To": "message.reply@example.com"
    },
    "important": false,
    "track_opens": null,
    "track_clicks": null,
    "auto_text": null,
    "auto_html": null,
    "inline_css": null,
    "url_strip_qs": null,
    "preserve_recipients": null,
    "view_content_link": null,
    "bcc_address": "message.bcc_address@example.com",
    "tracking_domain": null,
    "signing_domain": null,
    "return_path_domain": null,
    "merge": true,
    "merge_language": "mailchimp",
    "global_merge_vars": [{
            "name": "merge1",
            "content": "merge1 content"
        }],
    "merge_vars": [{
            "rcpt": "recipient.email@example.com",
            "vars": [{
                    "name": "merge2",
                    "content": "merge2 content"
                }]
        }],
    "tags": [
        "password-resets"
    ],
    "subaccount": "customer-123",
    "google_analytics_domains": [
        "example.com"
    ],
    "google_analytics_campaign": "message.from_email@example.com",
    "metadata": {
        "website": "www.example.com"
    },
    "recipient_metadata": [{
            "rcpt": "recipient.email@example.com",
            "values": {
                "user_id": 123456
            }
        }],
    "attachments": [{
            "type": "text/plain",
            "name": "myfile.txt",
            "content": "ZXhhbXBsZSBmaWxl"
        }],
    "images": [{
            "type": "image/png",
            "name": "IMAGECID",
            "content": "ZXhhbXBsZSBmaWxl"
        }]
};

Any suggestions? Critiques of the plan?