-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with mailgun routed data? #487
Comments
Hi. I don't familiar with mailgun api but aiohttp test suite has cases for multiple file uploading: |
I have mailed you with the post data that I receive on my api. Please have a look. There must be something which Mailgun is sending which is out of convention. |
I applied this patch and things worked fine. https://bugs.python.org/issue24764. Please see if any thing needs to be added on your end. Thanks |
I am using aiohttp. I have an api which handles Mailgun routed data. The emails have multiple attachments. I am not able to read all of the attachments. It just gives me a single one.
data is what I receive.
str(list(data.keys())) gives me the list -
['Content-Type', 'Date', 'Dkim-Signature', 'From', 'Message-Id', 'Mime-Version', 'Received', 'Received', 'Received', 'Subject', 'To', 'X-Envelope-From', 'X-Mailgun-Incoming', 'X-Received', 'attachment-count', 'body-html', 'body-plain', 'from', 'message-headers', 'recipient', 'sender', 'signature', 'stripped-html', 'stripped-signature', 'stripped-text', 'subject', 'timestamp', 'token', 'attachment-1']
str(data.get('attachment-count') gives me 2/3/4 when I send multiple files in the email - which is fine. But there is only one key as attachment-1. There should be 'attachment-1' and 'attachment-2' and so on.
I tried running a flask server and tested emails with multiple files:
print(request.files) prints ImmutableMultiDict([('attachment-2', <FileStorage: 'Screen Shot 2015-09-02 at 10.18.37 am.png' ('image/png')>), ('attachment-1', <FileStorage: 'Screen Shot 2015-09-02 at 10.18.36 am.png' ('image/png')>)])
which shows there are two files indeed.
Now there is certainly an issue with how aiohttp is handling the mailgun's data:
printing request.post() gives only one file - 'attachment-1': Field(name='attachment-1', filename='Screen Shot 2015-09-02 at 10.40.18 am.png', file=<_io.BufferedRandom name=10>, content_type='image/png'). There is no attachment-2, god knows why!
The text was updated successfully, but these errors were encountered: