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
0 answers

Getting connection refused when trying to connect to mail server using imaplib

I'm on a work network. I want to be able to download the attachment from coming from a specific email address to my local directory. But, for that first I need to be able to connect to the mail server. I'm doing the following to…
akrama81
  • 341
  • 1
  • 7
  • 18
0
votes
1 answer

Error when importing the imaplib package in Python

I am trying to import imaplib in the Python interpreter and getting the following errors related to nltk. >>> import imaplib Traceback (most recent call last): File "", line 1, in File…
Nikhil
  • 65
  • 1
  • 8
0
votes
1 answer

Python IMAPClient fetch() method optimization for large data

I am writing an email client using IMAPClient. My goal now is to render the list of messages in my INBOX. The number of messages amount to around 4 thousand. The problem is that it takes ages to fetch these letters like this: server =…
Edgar Navasardyan
  • 4,261
  • 8
  • 58
  • 121
0
votes
0 answers

Python: import body of email to text file result in PermissionError

I saw this code from a post here and wanted to see how it works: importing gmail text content to a text file with python returns nothing But when I try it an error appears. PermissionError: [Errno 13] Permission denied: 'C:\\email1.txt' this is the…
lu_laude
  • 91
  • 1
  • 9
0
votes
1 answer

Python imaplib, fetch unseen uids after uid

I want to fetch unseen UIDs greater than a given UID. I'm trying to do: result, numbers = server.uid('search', None, 'UNSEEN', str(minUID) + ':*') but that doesn't work properly. For 1:* I get all unseen UIDs correctly, but for minUID:* I'm only…
Dev Sanghani
  • 1,145
  • 11
  • 19
0
votes
0 answers

python: Exception in thread Thread-1

I am developing a client server code in python3.3. It worked well, I didn't change anything but suddenly when I run it this exception appeared:"Exception in thread Thread-1:" and it sends this error:"imaplib.abort: socket error: EOF". I really…
zeinab
  • 11
  • 7
0
votes
1 answer

How to gmail like forward email?

Is there any way to forward email(gmail like - you know... with additional text under) using smtp? Here is a piece of my code: def forward_email(email_id, email_to): client, messages = get_original_email(email_id) typ, data =…
Pavel Lankmiler
  • 327
  • 1
  • 2
  • 8
0
votes
1 answer

How to delete a specific email using only uid

I'm trying to delete an email remotely using python's imap4 library and the email's uid value. I have tried using this code but it hasn't worked. mail.store(uid,'+FLAGS','\\Deleted') mail.expunge() How do I delete this particular email?
McFizz
  • 3,013
  • 3
  • 18
  • 26
0
votes
1 answer

python3 imaplib search function encoding

Can someone point me out how to properly search using imaplib in python. The email server is Microsoft Exchange - seems to have problems but I would want a solution from the python/imaplib side. https://github.com/barbushin/php-imap/issues/128 I so…
Dnaiel
  • 7,622
  • 23
  • 67
  • 126
0
votes
1 answer

"SELECT command error BAD" during IMAP call to Gmail

I want to get G-mail with Google account by using IMAP. So I found some basic code how to use IMAP. And I run it with my Google account. But I get some errors. I don't know role of functions or parameters so please help me if you have gmail account…
Jung
  • 81
  • 10
0
votes
1 answer

Python error when connecting to Outlook IMAP - raise self.error(dat[-1]) error: LOGIN failed

I have a simple python program as follows - import imaplib mail = imaplib.IMAP4_SSL('mail.o365.mailserver.com') print mail.login('myuserid@domain.com', 'MyPassword') print('Logged in') I receive an error - File "C:\Python27\lib\imaplib.py", line…
Sree Nair
  • 91
  • 4
  • 11
0
votes
1 answer

PDF Attachment Downloader not working with base64 Encoding

I have a program that will pull file attachments into a network share. I have this working in both single part and multi-part email messages. I have recently received a mutlipart that is showing as : Content-Type:…
AlliDeacon
  • 1,365
  • 3
  • 21
  • 35
0
votes
1 answer

Trying to extract "Reply-To" header field in Python, not getting the email address

I tried to adapt this script I found by searching Google. Was working perfectly with the previous emails I was receiving, as it was directly extracting the "From" field, and I didn't get the error. Here is what my code looks like…
Vanity
  • 33
  • 2
  • 7
0
votes
2 answers

Python imaplib can't search by from address

I'm trying to find mails matching a particular FROM address. I've looked at this answer but it doesn't work for me. Here's the relevant code: import imaplib conn = imaplib.IMAP4_SSL(IMAPserver) conn.login(IMAPuserName, IMAPpassword) retVal, data =…
hyperwiser
  • 437
  • 1
  • 5
  • 19
0
votes
1 answer

Message not deleting with m.expunge

I have studied numerous questions and answers here and from what I can see my code is correct. For some reason though, the mail I have selected is not being deleted. My code is: m =…
Eoin
  • 357
  • 1
  • 4
  • 20