我正在尝试找出如何使用 golang 从 mailgun 接收电子邮件的文件附件。他们只提供 python 示例https://documentation.mailgun.com/en/latest/quickstart-receiving.html:
# 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')
我应该如何在 Go 中处理这部分,或者这个“文件”是什么类型?
# attachments:
for key in request.FILES:
file = request.FILES[key]
慕侠2389804
相关分类