0

I want to be able to delete just the attachment in an email and keep the text content. Can i do this using IMAPClient package?

I found this article which tells me there is some feature like that for mozilla thunderbird which is IMAP client. the link is :

http://www.howtogeek.com/112734/how-to-free-up-space-in-gmail-5-ways-to-reclaim-space/

how do i do this using imaplib or imapclient package in python 2.7?

CarbonD1225
  • 851
  • 6
  • 24
  • 39

1 Answers1

0

I think you are getting this wrong. IMAPClient is an IMAP client, so it can handle Imap, thunderbird is also an email (including Imap) client, so It's redudant, you don't need this to use that. Unfortunately IMAPclient doesn't seem to have an attachment handling method (atleast what I could tell from the docs). but a quick google search pointed me to python's native imaplib as a possible candidate to do what you want together with python's email lib. the first to access you gmail acount, and the second to get the message. a possible (also not exactly your use case) scenerio is outlined in this [receipe]ץ(http://code.activestate.com/recipes/302086-strip-attachments-from-an-email-message/)

also a very similiar stackoverflow question.

the trick is that there isn't a detach attachment method in **email* lib. you have to reset the message payload to simulate this effect.

Community
  • 1
  • 1
alonisser
  • 11,542
  • 21
  • 85
  • 139