Skip to content

ayuina/sendgrid-inbound-parse-by-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Receiving multipart/form-data POST by Azure Functions

This sample function code parse HTTP POST request that mime type is multipart/form-data and dump to log stream. This would be usefull for receiving webhook from SendGrid's inbound parse.

How to use

  1. Create Azure Functions app in your Azure account
  2. Deploy this in wwwroot or sync with repo

Description

When you want to parse HTTP request body encoded by multipart/form-data , you can get MultipartMemoryStreamProvider object by calling ReadAsMultipartAsync() method, then you can enumerate Contents property and parse each part of POSTed body with HttpContent object.

If you want to specific part of email, query MultipartMemoryStreamProvider.Contents property by the name of ContentDisposition header

Some output example

--- MultiPart Content ["from"] ---
Content-Disposition: form-data; name="from"

"[email protected]" <[email protected]>

--- MultiPart Content ["to"] ---
Content-Disposition: form-data; name="to"

"[email protected]" <[email protected]>

--- MultiPart Content ["html"] ---
Content-Disposition: form-data; name="html"

<html><body> Hello world !</body><html>

etc...

References

about SendGrid Inbound Parse Webhook

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages