vaefremov95 commented on issue #61766:
URL: https://github.com/apache/airflow/issues/61766#issuecomment-3899633514
HI!
I have tested new feature **max_mails** added in PR #60963 with my test
Airflow Deployment (Airflow==2.11. Python 3.12.3).
I used my company's production IMAP server and real-case scenario. I have 3
emails returned by filter, each with 2 attachments, but I needed to retrieve
only last mail.
I tested methods _has_mail_attachment_, _retrieve_mail_attachments_, and
_download_mail_attachments_ with different settings for max_mails.
Here are some logs:
```
[2026-02-13, 20:50:34 UTC] {logging_mixin.py:190} INFO - attachemnts found
with max_mails: True
[2026-02-13, 20:50:34 UTC] {logging_mixin.py:190} INFO - count attachments
without max_mails: 6
[2026-02-13, 20:50:34 UTC] {logging_mixin.py:190} INFO - count attachments
with max_mails=1: 2
[2026-02-13, 20:50:34 UTC] {logging_mixin.py:190} INFO - count attachments
with max_mails=1 and latest_only: 1
[2026-02-13, 20:50:38 UTC] {logging_mixin.py:190} INFO - downloaded
attachments without max_mails: 4
[2026-02-13, 20:50:39 UTC] {logging_mixin.py:190} INFO - downloaded
attachments with max_mails=1: 2
[2026-02-13, 20:50:40 UTC] {logging_mixin.py:190} INFO - downloaded
attachments with max_mails=1 and latest_only: 1
```
Everything works as expected, exept one detail. Since some files have same
names, _download_mail_attachments_ method overwrites them. So instead of 6
files I get 4. I guess that this is the default behavior of this method, that
occurs regardless of new feature **max_mails** but nevertheless it should be
fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]