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 3 imaplib different between windows/anaconda command prompts

I have some python code I use for emails that recently stopped working. Trying to debug it, I discovered that imaplib.IMAP4_SSL exists in python started from an anaconda prompt, but not a regular windows command prompt. How is this possible? Here's…
0
votes
0 answers

How can I search a mail in my imap folder starting from an EML file with python?

I'm trying to select a specific mail in my imap folder without having a clear identifier. The only thing I have is a plaintext copy of the mail saved as an eml file. I tried to load the mail from the file using the email module but I keep getting…
Forna
  • 149
  • 3
  • 13
0
votes
1 answer

unable to move/delete emails but CAN copy it

I can copy email to another folder but unable to delete it from INBOX (Office 365) #!/usr/bin/python import email, imaplib user = 'user@example.com' pwd = 'pass' conn =…
user10205566
0
votes
1 answer

Imaplib search for subject line with special characters using python

I'm trying to search special characters subject lines using typ, msg_ids = self.imap.uid('search', None, 'SUBJECT "Report #160496147 : "AU report QTD date wise MediaOps" from Dhruv Sapra"') but it's raising a bad request command error. Any idea why…
DKM
  • 1,761
  • 2
  • 19
  • 34
0
votes
0 answers

How can I use IDLE() method to check for new mails from the server using IMAP in Python?

I wrote the code to read mails from the server using IMAP in python. I have to run the program at each time to get the new mails. Hence I went through several tutorials 1, 2, where I found that While loop and idle() method can be used for this…
user10330249
0
votes
1 answer

Python IMAPLIB HTML body parsing

so basically i have this script that runs continuously and when a new email arrives in the inbox with specific text in the subject, it grabs information from the email. I have only managed to get it to pull the subject from the email but I cant get…
0
votes
1 answer

IMAPLIB "initial value must be str or none, not bytes" error

so im working on a script that basically runs in the background and pulls the data from any email that gets received containing a specific word in the subject and from a specific person. However, i cannot get it to parse the subject when running it…
0
votes
1 answer

Imaplib forward mail from gmail with attachment (Python)

Sorry for my english. I need get mail from gmail(this mail can contains attachments) and forward this mail from another email. Bellow my code for forward mail: for email_id in reversed(items): status, data =…
nesalexy
  • 848
  • 2
  • 9
  • 30
0
votes
0 answers

Loop Search for Imap / Python3 / Gmail

Have a bit of a problem and hoping you can help me What i am trying to do Connect to gmail Via Imap Loop through a list of subjects to search for Select the id and go and download the attachment got it working for 1 but when i go to run the loop…
pgodkin
  • 3
  • 2
0
votes
1 answer

Python : imaplib how to get primary emails only (Gmail)

Gmail automatically put emails under three different tabs: Primary, Social, Promotions, when I try to read the latest email with the code below, it gets all emails ignoring the tabs. How do I get email under Primary tab only? Is there another folder…
Frank
  • 1,315
  • 7
  • 24
  • 43
0
votes
1 answer

I want to grab all emails from an inbox using the Python IMAPLIB module... how can I do this?

This is where I am at, but I'm not sure where to go from here: import imaplib import email conn = imaplib.IMAP4() conn.login("username", "password") status, messages = conn.select('INBOX') if status != "OK": print ("Incorrect mail…
Adam
  • 11
  • 1
  • 2
0
votes
0 answers

ImapLibrary - Robotframework: keyword "Wait For Email" when no mails in mailbox

My script is to open mailbox and delete all the emails. Open Mailbox host=outlook.office365.com user=username password=pass ${count}= Wait For Email Delete All Emails Close Mailbox If count returns value, the script works.…
Minh
  • 21
  • 1
  • 5
0
votes
0 answers

python imaplib misses some emails

I'm using imaplib module to parse some of my emails (I'm filtering on FROM field). To do that I'm looping over folders, but seem to miss some emails. When I go to my gmail folder, the emails I miss are exactly those, that don't have "Inbox" label.…
LazyCat
  • 496
  • 4
  • 14
0
votes
1 answer

What does the output mean of imaplib.IMAP4_SSL().search in Python?

m = imaplib.IMAP4_SSL('imap.gmail.com') typ, accountDetails =m.login(userName, passwd) m.select("inbox") resp, data = m.search(None, "(ON {0})".format( time.strftime("%d-%b-%Y") ),'(FROM "email")' ) print(resp) print(data) This gives me the…
Sorath
  • 543
  • 3
  • 10
  • 32
0
votes
1 answer

User can't communicate with proxy

I'm implementing an IMAP proxy which securely communicates with a client.However, I have a problem when handshaking. The code of my proxy is: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.bind((host, port)) ssock, addr =…
Doomhammer
  • 23
  • 5