Skip to content

Instantly share code, notes, and snippets.

@SirRawlins
Last active December 13, 2015 18:18
Show Gist options
  • Save SirRawlins/4953756 to your computer and use it in GitHub Desktop.
Save SirRawlins/4953756 to your computer and use it in GitHub Desktop.
Making curl requests to mimic PostmarkApp Inbound Hook.
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "From": "[email protected]", "FromFull": { "Email": "[email protected]", "Name": "John Doe" }, "To": "451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com", "ToFull": [ { "Email": "451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com", "Name": "" } ], "Cc": "\"Full name\" <[email protected]>, \"Another Cc\" <[email protected]>", "CcFull": [ { "Email": "[email protected]", "Name": "Full name" }, { "Email": "[email protected]", "Name": "Another Cc" } ], "ReplyTo": "[email protected]", "Subject": "This is an inbound message", "MessageID": "22c74902-a0c1-4511-804f2-341342852c90", "Date": "Thu, 5 Apr 2012 16:59:01 +0200", "MailboxHash": "ahoy", "TextBody": "[ASCII]", "HtmlBody": "[HTML(encoded)]", "Tag": "", "Headers": [ { "Name": "X-Spam-Checker-Version", "Value": "SpamAssassin 3.3.1 (2010-03-16) onrs-ord-pm-inbound1.wildbit.com" }, { "Name": "X-Spam-Status", "Value": "No" }, { "Name": "X-Spam-Score", "Value": "-0.1" }, { "Name": "X-Spam-Tests", "Value": "DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_PASS" }, { "Name": "Received-SPF", "Value": "Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.160.180; helo=mail-gy0-f180.google.com; [email protected]; receiver=451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com" }, { "Name": "DKIM-Signature", "Value": "v=1; a=rsa-sha256; c=relaxed\/relaxed; d=wildbit.com; s=google; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; bh=cYr\/+oQiklaYbBJOQU3CdAnyhCTuvemrU36WT7cPNt0=; b=QsegXXbTbC4CMirl7A3VjDHyXbEsbCUTPL5vEHa7hNkkUTxXOK+dQA0JwgBHq5C+1u iuAJMz+SNBoTqEDqte2ckDvG2SeFR+Edip10p80TFGLp5RucaYvkwJTyuwsA7xd78NKT Q9ou6L1hgy\/MbKChnp2kxHOtYNOrrszY3JfQM=" }, { "Name": "MIME-Version", "Value": "1.0" }, { "Name": "Message-ID", "Value": "<CAGXpo2WKfxHWZ5UFYCR3H_J9SNMG+5AXUovfEFL6DjWBJSyZaA@mail.gmail.com>" } ], "Attachments": [ { "Name": "myimage.png", "Content": "[BASE64-ENCODED CONTENT]", "ContentType": "image/png", "ContentLength": 4096 }, { "Name": "mypaper.doc", "Content": "[BASE64-ENCODED CONTENT]", "ContentType": "application/msword", "ContentLength": 16384 } ] }' http://localhost:3000/your/hook/url
@SirRawlins
Copy link
Author

This mimics a basic test request to your applications hook URL. However the attachements aren't genuine Base64 encoded strings, I'll post an update version in time which does have them.

@SirRawlins
Copy link
Author

The gist has now been updated with a Base64 Encoded image as an attachment.

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