Quais sinalizadores IMAP são suportados de maneira confiável na maioria dos servidores de correio?


21

Estou escrevendo um aplicativo que reage aos emails enviados para uma caixa de correio. Ele recupera os e-mails via IMAP. Ele será implantado em vários sistemas nos quais eu não controlo a configuração do servidor de correio.

Gostaria de usar sinalizadores IMAP para indicar quais mensagens foram tratadas. Os sinalizadores do sistema são suficientemente suportados para que eu possa razoavelmente depender deles no meu aplicativo? Os sinalizadores definidos pelo usuário são suficientemente suportados?

(Se a resposta for "ha ha, sem chance", então usarei pastas.)

obrigado

-Ben

Respostas:


20

Veja esta coleção de exemplos de sessões do servidor IMAP . Essencialmente, sempre que você vir PERMANENTFLAGSconter \*, o servidor suportará sinalizadores definidos pelo usuário.

Para adicionar a essa lista, aqui está um trecho de uma sessão do Gimap (IMAP do Google Mail):

* OK Gimap ready for requests from 192.0.2.1 5if380490pzk.17
a login username password
* CAPABILITY IMAP4rev1 UNSELECT LITERAL+ IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE
a OK username@gmail.com authenticated (Success)
b select inbox
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]
* OK [UIDVALIDITY 2]
* 1089 EXISTS
* 0 RECENT
* OK [UIDNEXT 2371]
b OK [READ-WRITE] inbox selected. (Success)
c logout
* BYE LOGOUT Requested
c OK 73 good day (Success)

E da mesma forma, uma sessão do Exchange 2007:

* OK Microsoft Exchange Server 2007 IMAP4 service ready
00000000 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI IDLE NAMESPACE LITERAL+
00000000 OK CAPABILITY completed.
   [...]
00000003 SELECT INBOX
* 1 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
* OK [UIDVALIDITY 472] UIDVALIDITY value
* OK [UIDNEXT 7] The next unique identifier value
00000003 OK [READ-WRITE] SELECT completed.

Não consegui encontrar uma sessão do Exchange 2010.

Portanto, não é universal - com o Exchange sendo o notável abstêmio -, mas com certeza é mais comum do que não.


6

O principal documento de protocolo IMAP é RFC3501. A Seção 2.3.2 descreve os sinalizadores padrão com os quais toda implementação IMAP deve trabalhar.

Os sinalizadores do sistema são suficientemente suportados para que eu possa razoavelmente depender deles no meu aplicativo?

De fato, o RFC3501 descreve os sinalizadores do sistema universal.

Os sinalizadores definidos pelo usuário são suficientemente suportados?

Não há RFC no assunto de sinalizadores definidos pelo usuário, apenas propostas .

RFC 3501                         IMAPv4                       March 2003

2.3.2.  Flags Message Attribute

   A list of zero or more named tokens associated with the message.  A
   flag is set by its addition to this list, and is cleared by its
   removal.  There are two types of flags in IMAP4rev1.  A flag of
   either type can be permanent or session-only.

   A system flag is a flag name that is pre-defined in this
   specification.  All system flags begin with "\".  Certain system
   flags (\Deleted and \Seen) have special semantics described
   elsewhere.  The currently-defined system flags are:

        \Seen
           Message has been read

        \Answered
           Message has been answered

        \Flagged
           Message is "flagged" for urgent/special attention

        \Deleted
           Message is "deleted" for removal by later EXPUNGE

        \Draft
           Message has not completed composition (marked as a draft).

        \Recent
           Message is "recently" arrived in this mailbox.  This session
           is the first session to have been notified about this
           message; if the session is read-write, subsequent sessions
           will not see \Recent set for this message.  This flag can not
           be altered by the client.

           If it is not possible to determine whether or not this
           session is the first session to be notified about a message,
           then that message SHOULD be considered recent.

           If multiple connections have the same mailbox selected
           simultaneously, it is undefined which of these connections
           will see newly-arrived messages with \Recent set and which
           will see it without \Recent set.

   A keyword is defined by the server implementation.  Keywords do not
   begin with "\".  Servers MAY permit the client to define new keywords
   in the mailbox (see the description of the PERMANENTFLAGS response
   code for more information).

   A flag can be permanent or session-only on a per-flag basis.
   Permanent flags are those which the client can add or remove from the
   message flags permanently; that is, concurrent and subsequent
   sessions will see any change in permanent flags.  Changes to session
   flags are valid only in that session.

    Note: The \Recent system flag is a special case of a
    session flag.  \Recent can not be used as an argument in a
    STORE or APPEND command, and thus can not be changed at
    all.

4

O Exchange 2010 tem o mesmo conjunto de PERMANENTFLAGS

* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Perman
ent flags

1
O mesmo para o Office 365* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
Nisd
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.