I have this python code block set for an app that displays email on the FE from json.
So if the there are multiple attachments from the same FROM email, how do i get them together? Currently, only the last attachment in a mail with multiple attachments is entered into the json response.
Rather than overwriting user_content['ATTACH']
you could append to a sub-list. So instead of:
xxxxxxxxxx
for item in attach:
attach_name = item["filename"]
attach_path = uploads_dir + "/" + attach_name
print(attach_path)
user_content['ATTACH'] = attach_path
use something like:
xxxxxxxxxx
user_content['ATTACH'] = []
for item in attach:
attach_name = item["filename"]
attach_path = uploads_dir + "/" + attach_name
print(attach_path)
user_content['ATTACH'].append(attach_path)