Questions tagged [imaplib]

Python module to provide an Internet Message Access Protocol (IMAP) client implementation. This protocol lets you access mail folders stored on a central mail server, as if they were local.

Python module to provide an Internet Message Access Protocol (IMAP) client implementation. This protocol lets you access mail folders stored on a central mail server, as if they were local.

694 questions
0
votes
1 answer

python email subject \r\n

i have a trouble with a script to get the subject from my mailbox using imaplib. Here, is my script: for mail in response[0].split(): typ, response = imap.fetch(mail, '(RFC822)') for response_part in response: if…
0
votes
1 answer

Python imaplib Search using senders domain

I am trying to search using the IMAP search function to only return users that have sent emails from a specific domain. I am hoping this is actually possible. For example let's say I want to only fetch emails from users sending from addresses…
EnE_
  • 531
  • 1
  • 9
  • 19
0
votes
1 answer

How can I display email messages in Tkinter?

I've been writing an email application in python/tkinter, where I download the messages from my gmail then display them in a window. The problem I keep getting though is that most messages contain html and come out as gibberish. Is there any way…
Jay Jen
  • 705
  • 1
  • 7
  • 11
0
votes
1 answer

Trying to convert html to text in python?

I'm writing an email application in python. Currently when I try and display any emails using html it just displays the html text. Is there a simple way to convert an email string to just plain text to be viewed? The relevant part of my code: rsp,…
Jay Jen
  • 705
  • 1
  • 7
  • 11
0
votes
1 answer

Retrieving gmails through the browser

I want to retrieve all the mails from my gmail adress in order to compute some satistics. Problem is I need to run this at work and the connection to the imap google server is blocked and there is not much I can do about it. As I can access my mails…
Leo
  • 1,129
  • 4
  • 23
  • 38
0
votes
0 answers

Python imaplib - Correct password not accepted

I have a list of words in a text file. I am trying to run imap.login function against the words in that file. One of the words in that list is the password for the email ID. The script fails to recognise it as the password however, while I manually…
rickydj
  • 629
  • 5
  • 17
0
votes
1 answer

email.message_from_string() and imaplib adding '<' '>'

Alright so I load the email in from gmail with imaplib and then when I'm trying to parse the email it does not separate anything out in a usable format. I suspect this is because somewhere in the process '<' or '>' are being added to the raw…
Adrian773
  • 473
  • 11
  • 22
0
votes
1 answer

intermittent Bad File Descriptor error

I have a script to read messages on a mail server and save them in specific folders based on the content of the message bodies. Intermittently, usually about once or twice a day, it fails while executing this part of the code: if not…
CCKx
  • 1,303
  • 10
  • 22
0
votes
3 answers

Move mail in IMAP with Python library

Moving a message to a different folder seems quite difficult in IMAP. See IMAP: how to move a message from one folder to another How can I do this in Python without coding too much? I prefer to reuse :-)
guettli
  • 25,042
  • 81
  • 346
  • 663
0
votes
1 answer

IMAP's fetch('1:100', (X-GM-LABELS)) function does not fetch inbox, just emails labeled important?

Here is my code: import imaplib from email.parser import HeaderParser conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login('example@gmail.com', 'password') conn.select() conn.search(None, 'ALL') data = conn.fetch('1', '(BODY[HEADER])') header_data…
user4530588
0
votes
1 answer

HeaderParser() does not get all headers?

Here is my code: import imaplib from email.parser import HeaderParser conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login('example@gmail.com', 'password') conn.select() conn.search(None, 'ALL') data = conn.fetch('1', '(BODY[HEADER])') header_data…
user4530588
0
votes
1 answer

Pythons imaplib: fetch command, with or without parentheses, 'Invalid Fetch attribute' error for ALL item

I am trying to fetch messages from my IMAP server. This is a short version of my code: >>> import imaplib >>> m = imaplib.IMAP4_SSL(host='my.host.com') >>> m.login('username', 'password') >>> m.select('INBOX') The imaplib module in python3.4 is…
pato
  • 335
  • 1
  • 12
0
votes
1 answer

Python 3.4 - Connect to imap server using only TLSv1

I'm trying to connect to an imap mail server using only TLSv1 in Python 3.4. After much troubleshooting (most of which determined that the mail server only supports TLSv1), I've found that I can connect to the server using openssl: openssl s_client…
kavdev
  • 480
  • 4
  • 14
0
votes
1 answer

search archived messages using imap

The following code will search for a string from emails found in "inbox". My problem is that I need to search across all folders. M.selct("All") does not work. import imaplib M = imaplib.IMAP4_SSL('imap.gmail.com') M.login('sh.ak@gmail.com',…
shantanuo
  • 31,689
  • 78
  • 245
  • 403
0
votes
1 answer

IMAP4_SSL error retrieving gmail using Python with an Arduino Yún

The hell began when when we tried to go to Arduino Yún's linino environment. Initially we used this code: import imaplib import email mail = imaplib.IMAP4_SSL('imap.gmail.com') mail.login('user@example.com', 'password') mail.list() And eventually…
Francesc
  • 1
  • 2