I have a module which is supposed to extract the email attachment and place it at a specific, The code is working fine for attachments in emails, it also works for extracting rar files stored in the pc, I think the problem is in the path of rar files to attachments
for att in message.Attachments:
if att.FileName.endswith(".xlsx") :
# Give each attachment a path and filename
outfile_name1 = Myfolder + att.FileName
# save file
att.SaveASFile(outfile_name1)
elif att.FileName.endswith("rar"):
rf = rarfile.RarFile(att.FileName)
rf.extractall(Myfolder)