Comments (10)
I ended up making my own proxy model:
class AdastraMailbox(Mailbox):
class Meta:
proxy = True
def get_new_mail(self, condition=None):
"""Connect to this transport and fetch new messages."""
new_mail = []
connection = self.get_connection()
if not connection:
return new_mail
for message in connection.get_message(condition):
message_id = message['message-id'][0:255]
if not Message.objects.filter(message_id=message_id).exists():
msg = self.process_incoming_message(message)
new_mail.append(msg)
return new_mail
It works, as a suggestion it would be nice to have this feature of the box
from django-mailbox.
What mailbox do you use? What IMAP provider/server? Django Mailbox will delete messages immediately after processing them. Why the mail wasn't deleted? Is the question.
from django-mailbox.
I don't think your code are appreciate to merge. It will generate a tons of queries each update if mailbox aren't clean-uped. Mailbox SHOULD be clean-uped every update.
from django-mailbox.
I'm using Rackspace Webmail .
Mailbox does delete the messeges but I'm using the "archive=Inbox" parameter as specified on the docs and this allows me to keep a copy of email on the server. I don't see why it should be completely cleaned up on every update, I thought that was exactly IMAP was for ( only sync , not delete ) . I'm aware my solution isn't the most efficient but it works for now. I'd appreciate any feedback on this.
from django-mailbox.
Do you receive new e-mails to folder "Inbox" and archive them to folder "Inbox" again?
from django-mailbox.
Exactly
from django-mailbox.
Ahh; that's a very different use case than the one that caused the "archive" feature to be added; the idea behind the archive feature is that the module will copy the email message to a different folder for safekeeping after processing.
Regarding IMAP and sync vs. delete: although the protocol does allow for such a thing, django-mailbox always consumes every message it can find in its specified mailbox. Checking each message to determine whether it can be duplicated will get more and more time consuming over time, so for mailboxes having thousands of messages, you may want to consider the approach described above.
from django-mailbox.
The problem with consuming and deleting is that it seems more like a POP3 approach. IMAP was designed to access elements directly on their server so IMAPs benefits cannot be taken advantage of when using django-mailbox :( .
I found a similar django-client that does this using IMAP sync:
https://github.com/iggy/simone
However it lacks many features and doesn't seem as documented as django-mailbox.
Do you have any suggestion on dealing with thousands of messages without ending with my Hard Drive space?
Thanks.
from django-mailbox.
It could be possible to write an feature that, if a certain option is enabled in the settings module, only retrieves messages marked as unread, and which marks as read all messages that it downloads. I actually thought about doing that myself a while back, but abandoned the idea when I realized it didn't fit my use case.
Another option would be to store a copy of the mailbox locally, and when connecting to the imap server, only retrieve messages which don't exist in your local copy (by uid). But that would likely involve even more extensive changes to the package.
Much simpler would be to use the archive feature to move already retrieved messages from the inbox to another folder, with a name like 'archived' or 'processed'.
If you need the inbox to stay intact, one possibility might be to arrange on the server for all incoming messages to be copied to some folder, let's say it's called 'django-mailbox'. Then you can have django-mailbox consume from that folder, deleting or archiving the retrieved messages from that folder without touching the inbox.
from django-mailbox.
Hey there guys; I'm going to close this given that there isn't really anything actionable for anybody to do here. Let me know if you need any other help.
Cheers,
Adam
from django-mailbox.
Related Issues (20)
- From the Django Admin, using the ‘Get New Mail’ action from the action dropdown not working HOT 3
- django-allauth support for gmail OAuth HOT 1
- message_received signal not firing? HOT 2
- Missing migration? HOT 2
- ConnectionRefusedError: [Errno 111] Connection refused HOT 1
- documention not updating HOT 4
- get_new_mail from mailboxes inbox: where in mailbox are the loaded messages located? HOT 5
- ImportError: cannot import name ‘python_2_unicode_compatible’ from ‘django.utils.encoding’ (/opt/venv/lib/python3.8/site-packages/django/utils/encoding.py) HOT 12
- when will the new version of django_mailbox be released? HOT 2
- AttributeError: 'int' object has no attribute 'decode' HOT 1
- sort messages incoming date
- Error on fetch email from gmail using oauth2 but could be fetched using email and password
- Error when upgrading to Django 4.0 HOT 7
- Project status HOT 2
- Urgent: Error importing email HOT 4
- Microsoft Exchange Server/Outlook deprecating basic auth (IMAP and POP) HOT 2
- Is this package maintained?
- why is the logging level set to info for root logger?
- get_new_mail not working with Mailbox instance HOT 13
- Release a new version to introduce support for python 3.9 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-mailbox.