I am new to using mailgun. But I was tasked to create a C# MVC controller that will receive email messages forwarded by mailgun. I saw in the documentation released by mailgun a sample code to do this, but it uses Django, which I am not very much familiar with. Here is the sample code written in Django:
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')
my question now is, how am I going to convert this in C#? a sample code would definitely be amazing. Thanks for the help in advance. Sorry if you find this question stupid.