Closed InsomniakD closed 2 years ago
I'm also having same issue. For me mail has PDF attachment but message.attachments empty. Anyone help
Fixed this issue but the cause was coming from the way I send the attachement. Here i was using stmplib to send it but there was not any header for the attachement resulting to this in mail detail :
that's why it was not detected as attachement by Imbox now it look like this and it work perfectly :
and this is the code sample :
with open(zipfile, "rb") as attachment: payload = MIMEBase('application', 'octate-stream') payload.set_payload((attachment).read()) encoders.encode_base64(payload) #encode the attachment payload.add_header('Content-Disposition', 'attachment',filename="image.zip") message.attach(payload)
ask me if need help
I don't know if its clear in the title so i'll explain there. I made a python program that send an attachment to a mailbox which is the main mailbox of my project. The mail is sent from the mailbox to the mailbox so it is the same address for the receiver and for the sender. (see on pic)
here is my code wich work from attachment that not comming from the same mailbox.