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

How to copy email in INBOX into important mailbox with imaplib?

I am in python3.4 . import imaplib import email user="xxxx" password="yyyy" con=imaplib.IMAP4_SSL('imap.gmail.com') con.login(user,password) con.list() ('OK', [b'(\\HasNoChildren) "/" "INBOX"', b'(\\Noselect \\HasChildren) "/" "[Gma il]"',…
showkey
  • 482
  • 42
  • 140
  • 295
0
votes
1 answer

Download data from unread emails into separate files Python

I'm trying to download data from unread emails into csv files, in the sense, each unread email data goes into a separate csv file. I'm able to use imaplab and email to get the body of unread emails but I do not know how to save them into separate…
abn
  • 1,353
  • 4
  • 28
  • 58
0
votes
1 answer

Python IMAPlib ErrNo 10060

I'm writing a script to grab the link from an email that my web application sends out to then start off a set of automated tests. At the minute my code should only grab the body of the email, I haven't started to scan for the link within that yet…
LeonH
  • 1,039
  • 2
  • 22
  • 45
0
votes
1 answer

python 2.7 imaplib error

I tried to connect to my mail server via imaplib and got an error in constructor: My code: import imaplib imaplib.IMAP4_SSL('my_host.com', 1234) Error: Traceback (most recent call last) /home/username/www/site/ in…
eiscalle
  • 139
  • 2
  • 6
0
votes
2 answers

Why is this code from Jython imaplib suddenly not working?

I returned to some old code (not that old - circa 6 months) and all of a sudden I'm getting a rather inexplicable error. What makes it particularly surprising is that this is not in my code - it's in the copy of the stdlib that goes with my Jython…
theodox
  • 12,028
  • 3
  • 23
  • 36
0
votes
0 answers

how to find the sender email id using python

import imaplib def read(): username = "xxx@gmail.com" password = 'xxx' data = [] imap = imaplib.IMAP4_SSL("imap.gmail.com", 993) imap.login(username, password) imap.select('INBOX') # Print all unread messages from a…
0
votes
2 answers

Using Imap - Mail encoding weirdness

I'm using imap to retrieve mails from a server which works fine. I'm fetching the mails in RFC 822 like so: r, data = mailserver.fetch(mailnr, '(RFC822)') This gives me decipherable mails for the most part but now I have a multipart mail that looks…
pypat
  • 1,096
  • 1
  • 9
  • 19
0
votes
1 answer

Parsing email text body with imaplib

I want to get just email text body from Gmail(imap servers in general) without need to download the entire message. if I fetch for RC822, I can get everything just fine: mail_box.fetch(message_ids, '(RFC822)') But the problem is if I have too many…
rafanunes
  • 70
  • 8
0
votes
1 answer

Python IMAPClient/imaplib search unicode issue

I'm using the IMAPClient library, but I'm getting UnicodeEncodeError when doing a search. Below is a snippet and the stack trace: imap_client = imapclient.IMAPClient('imap.gmail.com', use_uid=True,…
john2x
  • 22,546
  • 16
  • 57
  • 95
0
votes
1 answer

oauth2 and imap connection with Gmail

I need to use oauth2 and imap to connect with Gmail, and I can see the code from https://github.com/simplegeo/python-oauth2: import oauth2 as oauth import oauth2.clients.imap as imaplib # Set up your Consumer and Token as per usual. Just like any…
Cacheing
  • 3,431
  • 20
  • 46
  • 65
0
votes
1 answer

How to use cyrillic in python IMAP search?

How can I use cyrillic symbols in imapObj.search()? I am doing the following IMAP search: imapObj.search("utf-8", "(SUBJECT '%s')" % u"кириллица".encode("utf-8")) And it doesn't work.
Sergey
  • 425
  • 1
  • 4
  • 11
0
votes
1 answer

Why are .CAB attachments I fetch with imaplib corrupt?

I have an email that I am trying to download the attachment from, using imaplib. I am using the Email library to translate messages to the email.message class. This is working perfectly for all of the emails I am dealing with, but when I fetch this…
Widdershin
  • 316
  • 3
  • 10
0
votes
1 answer

Extra Tabs in IMAP HTML Text

I'm using Python and imaplib to obtain emails from a IMAP server (supports all kinds of IMAP servers - GMail, etc.). My problem is: Using the IMAP BODY[INDEX] command to fetch a specific body part, the HTML comes with extra tabs. As…
user1034697
0
votes
1 answer

httplib to connect to IMAP email server?

I'm curious, can the httplib be jury rigged to connect to an IMAP email server? I'm being forced to python connect to an IMAP server without using IMAPlib and while I've learned a lot about sockets and IMAP, I'm frankly growing tired of the exercise…
Pinwheeler
  • 1,061
  • 2
  • 13
  • 26
0
votes
1 answer

Unknown Encoding in IMAP Message

I am obtaining text/HTML BODY parts of email messages using the IMAP protocol. For this, what I do is use the BODYSTRUCTURE call to obtain the BODY index and the charset of a part, then use the BODY[INDEX] call, obtain the raw text, and try to…
user1034697