Created
May 2, 2012 09:31
-
-
Save AymericG/2575531 to your computer and use it in GitHub Desktop.
Processing incoming emails from SendGrid.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
[ValidateInput(false)] | |
public ActionResult ProcessIncomingEmail(IncomingEmail email) | |
{ | |
var serializer = new JavaScriptSerializer(); | |
serializer.RegisterConverters(new[] { new DynamicJsonConverter() }); | |
email.envelope = serializer.Deserialize(HttpContext.Request.Form["envelope"], typeof(object)); | |
// Parse incoming to: email address | |
// Do something | |
return new EmptyResult(); | |
} | |
public class IncomingEmail | |
{ | |
public string text { get; set; } | |
public string html { get; set; } | |
public string from { get; set; } | |
public string to { get; set; } | |
public dynamic envelope { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment