Run the command: python manage.py runserver
Call the endpoint http://localhost:8000/mail_details/ and is GET request
{
"totalRecords": ,
"res":
[
{
"from": "",
"to": "",
"subject": "",
"data": "",
"messageId": "",
"text": "",
"attachments":
[
"fileName": "",
"coded": ""
]
}
]
}
Attachments are "ISO-8859-1 decoded" to strings
with open(f'{fileName}', 'wb') as fp:
fp.write(coded.encode("ISO-8859-1"))