0

IMAP STORE コマンドを Gmail で動作させるのに問題があります。グーグルから、他の何人かの人々がこの問題を抱えているようです。修正を見つけたようで、それが何であったかを決して言わなかった人もいれば、停止した人もいます。修正方法がわかりません。

Gmail に接続すると、メールボックスへの読み取り専用アクセスのみが与えられます

2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] C: '0003 EXAMINE INBOX'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '* FLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen)'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '* OK [PERMANENTFLAGS ()] Flags permitted.'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '* OK [UIDVALIDITY 1] UIDs valid.'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '* 22 EXISTS'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '* 0 RECENT'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '* OK [UIDNEXT 110] Predicted next UID.'
2013-03-05 01:22:47-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '0003 OK [READ-ONLY] INBOX selected. (Success)'

したがって、受信トレイを選択すると読み取り専用になります

その後、メッセージを削除しようとすると、このエラーが発生します

2013-03-05 01:43:04-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] C: '000E STORE 2 FLAGS.SILENT (\\Deleted)'
2013-03-05 01:43:04-0500 [IMAP4Client (TLSMemoryBIOProtocol),client] S: '000E NO STORE attempt on READ-ONLY folder (Failure)'

Twisted は、このエラーを報告します。読み取り専用フォルダーへの STORE 試行です。これは、読み取り専用アクセスしか与えられていないためです。READ-WRITE アクセスを取得するにはどうすればよいですか。

Traceback (most recent call last):
Failure: twisted.mail.imap4.IMAP4Exception: STORE attempt on READ-ONLY folder (Failure)

RFC 情報 https://www.rfc-editor.org/rfc/rfc3501#section-6.3.1

  If the client is permitted to modify the mailbox, the server
  SHOULD prefix the text of the tagged OK response with the
  "[READ-WRITE]" response code.

  If the client is not permitted to modify the mailbox but is
  permitted read access, the mailbox is selected as read-only, and
  the server MUST prefix the text of the tagged OK response to
  SELECT with the "[READ-ONLY]" response code.  Read-only access
  through SELECT differs from the EXAMINE command in that certain
  read-only mailboxes MAY permit the change of permanent state on a
  per-user (as opposed to global) basis.  Netnews messages marked in
  a server-based .newsrc file are an example of such per-user
  permanent state that can be modified with read-only mailboxes.

Gmail の IMAP 実装が壊れていることは知っていますが ( http://memegenerator.net/instance/35708036 )、Mail.app、Thunderbird などでメッセージを削除できると私が知る限り、読み取り/書き込みアクセスを取得するには何が欠けていますか? ....

削除コード

def delete_data(self, data_hash):
    if not self.hash_database.hash_in_list(data_hash):
        print "Data hash isn't uploaded yet"
        raise IOError("No such data hash uploaded")

    else:
        # delete it to prevent anyone from trying to download it while it is being deleted
        self.hash_database.delete_hash(data_hash)
        d = self.imap_connection.search("SUBJECT", "\"EMS Data ID: %s\"" % data_hash, uid = False)
        d.addCallback(self.delete_message)
        d.addErrback(self.deletion_error, data_hash)
        return d

def deletion_error(self, error, data_hash):
    print "Couldn't delete message hash %s" % data_hash
    print "========Deletion Error========"
    log.err(error)
    # restore hash to database
    self.hash_database.add_hash(data_hash)
    
    raise IOError("Couldn't delete message hash")
    

def delete_message(self, id):
    if len(id) == 0:
        raise IOError("Hash not found, however database indicates it was uploaded")
    d = self.imap_connection.setFlags(id[-1], ["\\Deleted"])
    d.addCallback(lambda result: self.imap_connection.expunge())
    return d
4

1 に答える 1

3

調べるのではなく、受信トレイを選択する必要があります。Examine は、メールボックスを読み取り専用で開くコマンドです。

于 2013-03-05T14:16:51.773 に答える