Questions tagged [imap-tools]

42 questions
0
votes
2 answers

How to write a function that that generates the login for a mailbox with imap_tools?

I created a helper function that logs into a mailbox. import imap_tools def mailbox_login(): try: with imap_tools.MailBoxUnencrypted(ENV["IMAP4_FQDN"]).login( ENV["RECEIVING_EMAIL_USER"], ENV["RECEIVING_EMAIL_PASSWORD"] …
trouble_bucket
  • 184
  • 3
  • 12
0
votes
1 answer

Search Emails in Mailbox with Imap_tools & Mailparser

First post after searching all over the site. I am trying to search the body of emails in a outlook mailbox for email addresses. I am using Imap_tools, MailParser and Beautiful Soup. I need to get any email address present in the body of the email…
litenchi
  • 1
  • 1
0
votes
1 answer

How to save files from Incoming email using imap_tools into AWS S3 bucket

I have an email server hosted on AWS EC2. I am using imap_tools for retrieving email content. when I tried to get the file through the payload, I get this return; att.payload # bytes: b'\xff\xd8\xff\xe0\' Please how do I get the actual…
0
votes
1 answer

How to extract delivery time from an email with Python?

I'm currently trying to automate incoming emails with python. I'm using the IMAP_TOOLS library. I've already managed to get the necessary values, but I need the time when the email response arrived, but I can't get this information from imap_tools…
0
votes
0 answers

Python Imap_tools fetch using subject is returning an error

I'm using python imap_tools to login on gmail and download it's attachments from specific emails. It was suposed to fetch by subject and a date, but subject is returning an error. The code works as expected when i use body instead of subject. The…
Sooplis
  • 1
  • 2
0
votes
2 answers

Get emails with imap_tools with python

I want to receive all the today's email texts from a specific sender and put them into a list from outlook with imap-tools I have made the following function but the problem is that it doesn't retrieve emails from 12:00AM - 12:00PM, is there any way…
David
  • 1
  • 3
0
votes
1 answer

Fetch email from Junk folder by string in body using imap_tools in Lambda

Using AWS Lambda with a Python script and imap_tools library https://github.com/ikvk/imap_tools#search-criteria I want to search the Junk folder for emails containing a specific string on the body, then move those emails to the Inbox. I have the…
0
votes
1 answer

Imap_tools Multiple NOT Conditions

I am using imap_tools to access and process our business emails. I would like to filter out multiple different from_ messages. Here's working code for filtering out one from_ address. This returns all emails within the date range except those from…
Martin H
  • 155
  • 2
  • 3
  • 14
0
votes
0 answers

impap_tools Mailbox.move showing MailboxExpungeError and UID Command Error (Python3)

I have part of a script that move emails from one folder to another folder within the same account. However, when I tried to move one email from one to the another, it's showing me the following errors below. There are two ways in which I've…
Daniel Lee
  • 13
  • 3
0
votes
1 answer

Getting ConnectionRefusedError on Github Actions but locally runs

I have an application that reads an email box. Locally I can run without problems but on GitHub Actions I'm getting the error below: Traceback (most recent call last): File…
ARNON
  • 1,097
  • 1
  • 15
  • 33
0
votes
1 answer

Assigning flags in imap_tools

I am using imap_tools and I am getting errors saying NameError: name 'imap_tools' is not defined. I thought it was maybe the way I imported it, but I have copied it directly from their repo and it isn't working. Has anyone come across this? from…
user19006684
0
votes
1 answer

imap_tools fetch where 'to_values' contained in supplied list

Sorry if this isn't a great question, Im using imap_tools (https://pypi.org/project/imap-tools/) to fetch mails that are to = emails provided in a list (forwarded to one imap). At the moment im using an if after fetching mails to see if 'to[0]' is…
J MGrice
  • 3
  • 3
0
votes
2 answers

Fetching E-mails 10 by 10 or n by n using Imap_tools python

I'm using Imap_tools library and I'm trying to fetch the emails in a folder 10 by 10 (for pagination and performance purposes) when I tried using limit and passing a tuple to it like so: mails = mailbox.fetch(reverse = True, headers_only = True,…
0
votes
2 answers

How to mark an email as seen after reading it with 'mark_seen = False' in imap_tools python?

So first of all this is my code: with MailBox('imap.gmail.com').login('username', 'password', 'INBOX') as mailbox: for msg in mailbox.fetch(AND(mark_seen=False, from_="some_domain")): prt_msg_text = msg.text …
0
votes
1 answer

Encode() Argument Error When Fetching Emails

I am trying to fetch emails using imap_tools. I want to limit the fetch to new emails that contain the word "order" in the subject but do not contain any of the words "stock", "return" and "delivery" in the subject. I thought this line would do it…
James
  • 390
  • 1
  • 9