message.Body empty

Topics: Help requests
Apr 11, 2014 at 7:22 AM
Hi Pavel,

I just tried the last source code on GMAIL server and all is ok but on Microsoft Exchange i get no body.

message.Body.HasHtml is true but message.Body.Html is empty.


IMAPX1 CAPABILITY
  • CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN IDLE NAMESPACE LITERAL+
    IMAPX1 OK CAPABILITY completed.
    IMAPX2 LOGIN "pablo.vidal@ibericar.gal" "removed pass"
IMAPX2 OK LOGIN completed.
IMAPX3 LIST "" %
  • LIST (\Marked \HasNoChildren) "/" INBOX
  • LIST (\HasNoChildren) "/" "Bandeja de salida"
  • LIST (\HasNoChildren) "/" Borradores
  • LIST (\HasNoChildren) "/" Calendario
  • LIST (\HasNoChildren) "/" Contactos
  • LIST (\HasNoChildren) "/" "Correo no deseado"
  • LIST (\HasNoChildren) "/" Diario
  • LIST (\HasNoChildren) "/" "Elementos eliminados"
  • LIST (\HasNoChildren) "/" "Elementos enviados"
  • LIST (\HasNoChildren) "/" "Fuentes RSS"
  • LIST (\HasNoChildren) "/" Ibericar
  • LIST (\HasNoChildren) "/" Notas
  • LIST (\HasChildren) "/" "Problemas de sincronizaci&APM-n"
  • LIST (\HasNoChildren) "/" Tareas
    IMAPX3 OK LIST completed.
    IMAPX4 EXAMINE "INBOX"
  • 25 EXISTS
  • 1 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UNSEEN 14] Is the first unseen message
  • OK [UIDVALIDITY 788] UIDVALIDITY value
  • OK [UIDNEXT 18953] The next unique identifier value
    IMAPX4 OK [READ-ONLY] EXAMINE completed.
    IMAPX5 EXAMINE "Bandeja de salida"
  • 39 EXISTS
  • 39 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 789] UIDVALIDITY value
  • OK [UIDNEXT 4292] The next unique identifier value
    IMAPX5 OK [READ-ONLY] EXAMINE completed.
    IMAPX6 EXAMINE "Borradores"
  • 2 EXISTS
  • 2 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 801] UIDVALIDITY value
  • OK [UIDNEXT 1307] The next unique identifier value
    IMAPX6 OK [READ-ONLY] EXAMINE completed.
    IMAPX7 EXAMINE "Calendario"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 799] UIDVALIDITY value
  • OK [UIDNEXT 12635] The next unique identifier value
    IMAPX7 OK [READ-ONLY] EXAMINE completed.
    IMAPX8 EXAMINE "Contactos"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 800] UIDVALIDITY value
  • OK [UIDNEXT 139] The next unique identifier value
    IMAPX8 OK [READ-ONLY] EXAMINE completed.
    IMAPX9 EXAMINE "Correo no deseado"
  • 4 EXISTS
  • 4 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UNSEEN 1] Is the first unseen message
  • OK [UIDVALIDITY 806] UIDVALIDITY value
  • OK [UIDNEXT 26] The next unique identifier value
    IMAPX9 OK [READ-ONLY] EXAMINE completed.
    IMAPX10 EXAMINE "Diario"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 802] UIDVALIDITY value
  • OK [UIDNEXT 1] The next unique identifier value
    IMAPX10 OK [READ-ONLY] EXAMINE completed.
    IMAPX11 EXAMINE "Elementos eliminados"
  • 184 EXISTS
  • 184 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UNSEEN 178] Is the first unseen message
  • OK [UIDVALIDITY 791] UIDVALIDITY value
  • OK [UIDNEXT 30061] The next unique identifier value
    IMAPX11 OK [READ-ONLY] EXAMINE completed.
    IMAPX12 EXAMINE "Elementos enviados"
  • 3 EXISTS
  • 3 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 790] UIDVALIDITY value
  • OK [UIDNEXT 8557] The next unique identifier value
    IMAPX12 OK [READ-ONLY] EXAMINE completed.
    IMAPX13 EXAMINE "Fuentes RSS"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 955] UIDVALIDITY value
  • OK [UIDNEXT 1] The next unique identifier value
    IMAPX13 OK [READ-ONLY] EXAMINE completed.
    IMAPX14 EXAMINE "Ibericar"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 72603] UIDVALIDITY value
  • OK [UIDNEXT 65] The next unique identifier value
    IMAPX14 OK [READ-ONLY] EXAMINE completed.
    IMAPX15 EXAMINE "Notas"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 803] UIDVALIDITY value
  • OK [UIDNEXT 11] The next unique identifier value
    IMAPX15 OK [READ-ONLY] EXAMINE completed.
    IMAPX16 EXAMINE "Problemas de sincronizaci&APM-n"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 951] UIDVALIDITY value
  • OK [UIDNEXT 1] The next unique identifier value
    IMAPX16 OK [READ-ONLY] EXAMINE completed.
    IMAPX17 LIST "Problemas de sincronizaci&APM-n/" %
  • LIST (\HasNoChildren) "/" "Problemas de sincronizaci&APM-n/Conflictos"
  • LIST (\HasNoChildren) "/" "Problemas de sincronizaci&APM-n/Errores del servidor"
  • LIST (\HasNoChildren) "/" "Problemas de sincronizaci&APM-n/Errores locales"
    IMAPX17 OK LIST completed.
    IMAPX18 EXAMINE "Problemas de sincronizaci&APM-n/Conflictos"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 952] UIDVALIDITY value
  • OK [UIDNEXT 1] The next unique identifier value
    IMAPX18 OK [READ-ONLY] EXAMINE completed.
    IMAPX19 EXAMINE "Problemas de sincronizaci&APM-n/Errores del servidor"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 954] UIDVALIDITY value
  • OK [UIDNEXT 1] The next unique identifier value
    IMAPX19 OK [READ-ONLY] EXAMINE completed.
    IMAPX20 EXAMINE "Problemas de sincronizaci&APM-n/Errores locales"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 953] UIDVALIDITY value
  • OK [UIDNEXT 1] The next unique identifier value
    IMAPX20 OK [READ-ONLY] EXAMINE completed.
    IMAPX21 EXAMINE "Tareas"
  • 0 EXISTS
  • 0 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS ()] Permanent flags
  • OK [UIDVALIDITY 804] UIDVALIDITY value
  • OK [UIDNEXT 2] The next unique identifier value
    IMAPX21 OK [READ-ONLY] EXAMINE completed.
    IMAPX22 SELECT "INBOX"
  • 25 EXISTS
  • 1 RECENT
  • FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
  • OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
  • OK [UNSEEN 14] Is the first unseen message
  • OK [UIDVALIDITY 788] UIDVALIDITY value
  • OK [UIDNEXT 18953] The next unique identifier value
    IMAPX22 OK [READ-WRITE] SELECT completed.
    IMAPX23 UID SEARCH UNSEEN FROM vehiculosocasion@coches.net
  • SEARCH 18952
    IMAPX23 OK SEARCH completed.
    IMAPX24 UID FETCH 18952 (FLAGS INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS (FROM TO DATE SUBJECT CC CONTENT-TYPE)] BODYSTRUCTURE)
  • 25 FETCH (FLAGS (\Recent) INTERNALDATE "11-Apr-2014 09:00:15 +0200" RFC822.SIZE 8821 BODY[HEADER.FIELDS (FROM TO DATE SUBJECT CC CONTENT-TYPE)] {284}
    From: "vehiculosocasion@coches.net" vehiculosocasion@coches.net
    To: "vo@cuzcomotor.net.bmw.es" vo@cuzcomotor.net.bmw.es
    Date: Fri, 11 Apr 2014 08:57:08 +0200
    Subject: Hay una persona interesada en tu anuncio publicado en Coches.net
    Content-Type: text/html; charset="utf-8"
BODYSTRUCTURE ("text" "html" ("charset" "utf-8") NIL NIL "base64" 0 0 NIL NIL "es-ES" NIL) UID 18952)
IMAPX24 OK FETCH completed.
IMAPX25 UID FETCH 18952 (BODY.PEEK[1.MIME] BODY.PEEK[1])
  • 25 FETCH (BODY[1.MIME] NIL BODY[1] {8918}
    [removed binary]
    UID 18952)
    IMAPX25 OK FETCH completed.
    IMAPX26 UID STORE 18952 +FLAGS (\Recent \Seen)
IMAPX26 BAD Command Argument Error. 11
IMAPX27 LOGOUT
  • BYE Microsoft Exchange Server 2007 IMAP4 server signing off.
    IMAPX27 OK LOGOUT completed.
Coordinator
Apr 11, 2014 at 2:29 PM
Hi Vaidal,

thank you for the provided server response! I made another update on this issue, you can try the latest code from the repository.

Greets,

Pavel
Apr 14, 2014 at 10:29 AM
Thanks!

Body is ok now.

I have a minor issue on ValidateAndGetTimeZoneOffsetValues.

offset="+0200Subject:" and method throws FormatException:
    private static void ValidateAndGetTimeZoneOffsetValues(string offset, out bool positive, out int hours, out int minutes)
    {
        if (offset.Length != 5) 
            throw new FormatException();

This is the trace:
  • SEARCH
    IMAPX45 OK SEARCH completed.
    IMAPX46 UID SEARCH UNSEEN FROM **************
  • SEARCH 18972 18973 18974 18975 19014
    IMAPX46 OK SEARCH completed.
    IMAPX47 UID FETCH 18972 (FLAGS INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS (FROM TO DATE SUBJECT CC CONTENT-TYPE)] BODYSTRUCTURE)
  • 21 FETCH (FLAGS () INTERNALDATE "13-Apr-2014 00:54:18 +0200" RFC822.SIZE 2390 BODY[HEADER.FIELDS (FROM TO DATE SUBJECT CC CONTENT-TYPE)] {385}
    From: "***" <>
    To: "*" <>
    CC: "*" <>
    Date: Sun, 13 Apr 2014 00:54:13 +0200
    Subject:
    =?utf-8?B?U2l0ZSB3d3cuaWJlcmljYXJjdXpjby5lcyAtIEVzdG95IEludGVyZXNzYWRv?=
    =?utf-8?B?IGVuIEVzdGUgVmVow61jdWxv?=
    Content-Type: text/plain; charset="utf-8"
BODYSTRUCTURE ("text" "plain" ("charset" "utf-8") NIL NIL "base64" 0 0 NIL NIL "es-ES" NIL) UID 18972)
IMAPX47 OK FETCH completed.
Coordinator
Apr 14, 2014 at 5:38 PM
Hi Vaidal,

please check the latest code, I fixed this issue just now.

Best regards,

Pavel
Apr 15, 2014 at 9:51 AM
Hi Pavel,

All is ok now.... thanks for such a great support !!!