我是使用 mailgun 的新手。但我的任务是创建一个 C# MVC 控制器,它将接收 mailgun 转发的电子邮件消息。我在 mailgun 发布的文档中看到了一个示例代码来执行此操作,但它使用了我不太熟悉的 Django。下面是用 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')
我现在的问题是,我将如何在 C# 中转换它?一个示例代码肯定会很棒。我在这里先向您的帮助表示感谢。对不起,如果你觉得这个问题很愚蠢。