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

IMAPLIB: Is there any MOVED flag to identify mails moved between mailboxes

I have a python script that connects to an IMAP server. The script downloads the mails from the server in a certain format. The second time the script is run, rather than downloading all the mails, it should download new mails (synchronize) to avoid…
Rishik Mani
  • 490
  • 8
  • 27
0
votes
2 answers

Python imaplib .search email subject Chinese got error

I want to use imaplib to search particular emails, which subjects contain Chinese. I got the error like this: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) so i use .encode to encode to…
0
votes
1 answer

ImapLib get gmail id mail(python)

Sorry for my english. For example i have link like this https://mail.google.com/mail/u/0/?source=sync&tf=1&view=pt&th=1614fcf57d5cb6ec1&search=all where 1614fcf57d5cb6ec1 it uuid message. By this link i can view pdf mail. For work with mail i use…
r1299597
  • 609
  • 3
  • 10
  • 20
0
votes
1 answer

Downloading excel attachments using imaplib

There's an email blasted out every morning containing an Excel attachment. I would like to be able to grab each of these attachments and save them into the same folder. I attempted the following code: Downloading multiple attachments using…
Marshall Gu
  • 137
  • 3
  • 14
0
votes
1 answer

imaplib save authenticate pythone

Sorry for my english. I use imaplib for email operations. I try save authenticate, for save my password. I found method IMAP4.login_cram_md5 but how it use? This is my example IMAP_SERVER = 'imap.gmail.com' IMAP_PORT = '993' IMAP_USE_SSL =…
r1299597
  • 609
  • 3
  • 10
  • 20
0
votes
0 answers

Python: Getting Info of Email with IMAP library results in "None" for data

I have been working on a small email utility in Python after following an online tutorial. The only issue seems to be the data I am printing is None. For example, the sender and subject of the email, when printed, are None. Here is my code: import…
nedrathefr
  • 215
  • 1
  • 5
  • 13
0
votes
1 answer

How to select a specific mailbox from IMAP server?

I have the following mailboxes on my IMAP server (refer to the attached screenshot). I want to only select the mailbox Folder1 and check if there are any sub-directories. I already tried the following code: svr =…
Rishik Mani
  • 490
  • 8
  • 27
0
votes
0 answers

Access Gmail Account using IMAPlib in Python 3.6

Here is my code in python 3.6: import imaplib, email, os from imaplib import * username = 'username@gmail.com' password = 'password' print("Logging into your Gmail Account...") mail =…
Yash Sangai
  • 334
  • 1
  • 9
0
votes
1 answer

Messages autoread when using imaplib

I've been using imaplib and python for some time now and I've been rewriting some of my code. I've recently run into an issue where the messages are being set to read when I access the headers for the emails. I'm using this c.fetch('(UID…
vagamens
  • 75
  • 1
  • 9
0
votes
1 answer

Can't save new message to Drafts in gmail

I am trying to create and save message to Drafts in gmail, but nothing happen. import time import random from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import…
Dmitrii K
  • 249
  • 2
  • 13
0
votes
2 answers

Fetch unseen mails with python vom Gmail

with the python script below I try to fetch mails from gmail. Im my mailbox is only one unread message, but the script gives me the following output: [b'330 332 335 337 339 340 341 ...... 450] With an other provider an one unread Mail I get the…
Jan
  • 1
  • 2
0
votes
0 answers

Getting a Gmail email as a string - also how do I obtain an image from the email

I have retrieved the body of an email in Gmail using the following code. I now want to search it and pick out certain parts of the body text using something similar to the find command you use on strings. E.G. DVRName =…
AndyDav
  • 1
  • 2
0
votes
1 answer

Extract subject and sender using python (imaplib)

I know there are some other posts out there, but i tried to use them but most of I couln´t make them run or they are simply to old. I hope there is someone that can help me. I simply want to extract the subject and the sender of all new emails in…
Johmen12
  • 29
  • 7
0
votes
1 answer

Send mails with Python and an IMAP/SMTP Server

i have a couple issues with sending Email with Python using my own SMTP/IMAP Server. Here's the code : import sys import imaplib import smtplib import email import email.header import datetime smtp_session = smtplib.SMTP(mail_server) try: …
Aurelien
  • 688
  • 1
  • 9
  • 22
0
votes
0 answers

Py3 imaplib: get only immediate body (no reply) of email

I'm using python3 and imaplib to retrieve emails from an inbox, so far so good. But these emails are part of a reply chain, and the part payload I get includes the message I reply to as well as the original email content. Is there a way to get only…
IronWaffleMan
  • 2,513
  • 5
  • 30
  • 59