Code Monkey home page Code Monkey logo

Comments (10)

gusreyes01 avatar gusreyes01 commented on June 22, 2024

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.

ad-m avatar ad-m commented on June 22, 2024

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.

ad-m avatar ad-m commented on June 22, 2024

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.

gusreyes01 avatar gusreyes01 commented on June 22, 2024

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.

ad-m avatar ad-m commented on June 22, 2024

Do you receive new e-mails to folder "Inbox" and archive them to folder "Inbox" again?

from django-mailbox.

gusreyes01 avatar gusreyes01 commented on June 22, 2024

Exactly

from django-mailbox.

coddingtonbear avatar coddingtonbear commented on June 22, 2024

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.

gusreyes01 avatar gusreyes01 commented on June 22, 2024

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.

leifurhauks avatar leifurhauks commented on June 22, 2024

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.

coddingtonbear avatar coddingtonbear commented on June 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.