http://documentation.mailgun.net/quickstart.html contains some example code for a http handler in Django:
# Handler for HTTP POST to http://myhost.com/messages for the route defined above
def on_incoming_message(request):
if request.method == 'POST':
sender = request.POST.get('sender')
recipient = request.POST.get('recipient')
subject = request.POST.get('subject', '')
body_plain = request.POST.get('body-plain', '')
body_without_quotes = request.POST.get('stripped-text', '')
# note: other MIME headers are also posted here...
# attachments:
for key in request.FILES:
file = request.FILES[key]
# do something with the file
# Returned text is ignored but HTTP status code matters:
# Mailgun wants to see 2xx, otherwise it will make another attempt in 5 minutes
return HttpResponse('OK')
What is the equivalent in ASP.NET C#?
I have tried Request.Form["sender"] for example, but the Mailgun log records a HTTP 500 error code.
Thanks for your help.
My VB.Net Version
I needed to set ValidateRequest to false in the page directive.
Sample Code-
sms.aspx
sms.aspx.cs
Hope this helps someone else using Mailgun and C#.
Main I wish i would have found this about 6 hours ago ...
Here is what you need to do if you are using mvc and the razor view engine