How do I filter inbox and only download emails that have attachments

Tianyi Chen

I am filtering a fairly large inbox using exchangelib. I only want to look at emails that have attachments.

I tried to add the attachments=True clause in the filter but it does not work. Below is my code. Could someone tell me what is the correct way of doing this?

account.inbox.filter(datetime_received__range=(start_time, end_time), sender=some_sender, attachments=True)
Erik Cederstrand

You probably want to filter on the has_attachments filter instead. I don't think you can filter directly on an attachment. Also, you may want to only select the fields that you need, using .only():

account.inbox.filter(
    datetime_received__range=(start_time, end_time),
    sender=some_sender,
    has_attachments=True,
).only('sender', 'subject', 'attachments')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I download all emails with attachments from Gmail?

How do I move emails from a folder to the inbox in Outlook?

How can I download attachments from emails through terminal using getmail?

How do I get thunderbird to give notifications for only my inbox

How do i send emails with attachments in react native (using my own SMTP server)?

How can I refresh the XPages File Download Control and have it display updated attachments without full page refresh?

How to move ONLY messages that have attachments?

How do I filter out or skip meeting responses in my inbox using ExchangeLib? Currently getting AttributeError

I want to attach multiple email addresses to a single inbox and then filter the emails that are received into folders

Fetch emails from gmail from inbox only

How to filter the Google Api inbox to read only the main messages?

How do I filter csv email attachments via RouteonAttributes by attachment name?

How do i filter JSON based on a key, so i only have a list of one type of key for all objects

How do I download source code from particular repo with only files that have been changed or added during a particular commit in that repo?

How can I filter emails by IP in Thunderbird?

Using a dictionary to pull Email Addresses. Some key's have multiple emails, how do I send to all emails?

Python : How can I access Lotus Notes 8.5 Inbox to read emails

How do I send Email with inline Attachments

Console App to search outlook inbox with subject line filter skipping emails

Is there a way to make emails skip the inbox without a filter in Google Apps Script?

R: How do I split an email into parts when the emails have multiple domain endings?

How do I properly set wget to download only new files?

How do I download ONLY the YouTube playlist, NOT the files therein?

Moving emails with specified attachments from shared inbox to a different folder of the same shared mailbox

Fetching email ID's of only the emails in the main Gmail Inbox

How can I filter off thumbnails attachments in beautifulsoup?

How do I configure Postfix to only relay emails from a specific domain?

In Jenkins, How do I send emails only when the branch failed is the master branch?

How do I set Thunderbird to notify me of new emails in only certain folders?