Re: [imapext] REQUESTING FOR SUPPORT TO IMPLEMENT IMAP FETCH COMMAND

Barry Leiba <barryleiba@computer.org> Mon, 02 July 2018 06:45 UTC

Return-Path: <barryleiba.mailing.lists@gmail.com>
X-Original-To: imapext@ietfa.amsl.com
Delivered-To: imapext@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5DFE1130E17 for <imapext@ietfa.amsl.com>; Sun, 1 Jul 2018 23:45:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.399
X-Spam-Level:
X-Spam-Status: No, score=-1.399 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yk-cT7emfg3k for <imapext@ietfa.amsl.com>; Sun, 1 Jul 2018 23:45:31 -0700 (PDT)
Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 55E83130DF4 for <imapext@ietf.org>; Sun, 1 Jul 2018 23:45:31 -0700 (PDT)
Received: by mail-qt0-x233.google.com with SMTP id y31-v6so12976834qty.9 for <imapext@ietf.org>; Sun, 01 Jul 2018 23:45:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=SH35iWsU6zLR2Jq3DTRM5qpKI2xxQrIpiOrR9EfQO/Y=; b=eVoWSFRucqU7nVNd8KHk5/wzbf8iOz8AzmOPkxg3z7igS8uCyOB4PbF6KyHg91ojqT Yk0dxf3tIumjJhIZv2eocAE7Que+JuyYjZpKJJvz8ufCgszUEIDums5gGJYYRLAlaAtZ tTSeN6lXPbYpWEaysgOkJ33zX1MoqqqJjY/YMHYDwkkDVX9eckI8TFROlOUHFn+DBLCC Itw2n/E4HpDPM4ReFkuY8g+pAnm7Kdx+N/jSYmiWubVDu20piIxlBzMBfI4nMMoQolSU Gg8GuaiAD14sVTDSdN8yapTiuf2gtG9Xhpl/J/1u2LfgU3sdrafFuA0KDYKopzY5xId5 nLnQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=SH35iWsU6zLR2Jq3DTRM5qpKI2xxQrIpiOrR9EfQO/Y=; b=Bcri/v3oXnuLrkmONZjvLEy/etEN6eAKf1q2TJy4lplbZUPK3E8BTucMwoNocl95Q/ 4gspo1BFgJQkqX0aetH3YoZD85S+yTqrj6xsnKiNReufyS8/4vD+0x5Sbt3gZ8xNqun4 eC4S4FvOxMfuEVSb9HC9uXwZneRgqEAb+rpT1u8kb+57ccYvMTfK9xlSTZWqEIASDJxM DGAKqLc66Y++roVucAeWIsZ8F92yxH87yWNfLJRhb9H0w6WCVkvVJ+/wtQ0sxZgB2ai6 pnUV0MGlaWIj1VJVsQqfLfzYaqDcfwC/1c2+gpqIzZbCFd1sqV1+ozv+e6Hiy8IgKQba s1FA==
X-Gm-Message-State: APt69E2dm2yF+YLKbxLlPJY2VqsRODVZpn2v6yLCyw/zVcGQ1BUBxqSM PlsY05cfkj/5aQMGTWu0r1NTIIb2ArK4WrDYzzQ=
X-Google-Smtp-Source: AAOMgpeKLUtowjotcrQKLng+PXCk01Bikqmdx1FAnq4tIK440X27KvGkwZBlxGklMKP+l+P+P2bcd1fwphiv5h88uiA=
X-Received: by 2002:aed:3e82:: with SMTP id n2-v6mr22314334qtf.359.1530513930406; Sun, 01 Jul 2018 23:45:30 -0700 (PDT)
MIME-Version: 1.0
Sender: barryleiba.mailing.lists@gmail.com
Received: by 2002:ac8:70cd:0:0:0:0:0 with HTTP; Sun, 1 Jul 2018 23:45:29 -0700 (PDT)
In-Reply-To: <CACsjV1z3GVT7vAYDLs1SMU_VXtaZvYBpLv-RSDj3UxrLrL879A@mail.gmail.com>
References: <CACsjV1zdMJkgsUFrdB8tUbkLw-_N0JzVxd5zQUErV_LhxT_R_Q@mail.gmail.com> <3358ED02-9B0E-419D-9BD2-EA9FD459D7B6@oracle.com> <CACsjV1z3GVT7vAYDLs1SMU_VXtaZvYBpLv-RSDj3UxrLrL879A@mail.gmail.com>
From: Barry Leiba <barryleiba@computer.org>
Date: Mon, 02 Jul 2018 02:45:29 -0400
X-Google-Sender-Auth: W6mk9q4sNen3K2ZwMun9W8ZbRLM
Message-ID: <CAC4RtVBXnR0KQXTD8raqS2iYjDCyLiOxwwpPG5JWm+aMmt1R=w@mail.gmail.com>
To: sayantan pal <sayantan.pal19@gmail.com>
Cc: Chris Newman <chris.newman@oracle.com>, imapext@ietf.org
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/imapext/Ox0P8Rauen0ni18ecgE2WDNqQME>
Subject: Re: [imapext] REQUESTING FOR SUPPORT TO IMPLEMENT IMAP FETCH COMMAND
X-BeenThere: imapext@ietf.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: Discussion of IMAP extensions <imapext.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/imapext>, <mailto:imapext-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/imapext/>
List-Post: <mailto:imapext@ietf.org>
List-Help: <mailto:imapext-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/imapext>, <mailto:imapext-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jul 2018 06:45:34 -0000

As Chris said, we're not here to help you debug your implementation.
But I'll give you some hints for free, after a quick check of what you
sent:

> server: * 1 FETCH (UID 2 FLAGS (\SEEN) RFC822.SIZE 4794 BODY[HEADER] {4348}

A quick eyeball of the .msg file that you included shows that both
your RFC822.SIZE and body header literal length value appear to be way
off.  The correct body header size looks like it's a little more than
2700 bytes.

The only reason I'm spending a little time on this is to note that
literals are hard for many people to grasp, and lots of implementers
are confused by them at first.

For example, the first line of the message, <<X-Recent: Recent>>
contributes 18 bytes to the BODY[HEADER] literal -- one byte each for
each of the 16 characters there, plus one for the CR and one for the
LF that follow the string.  The next header field (the "Received"
header) adds another 72 + 2 + 69 + 2 -- 72 bytes for the first line, a
CRLF, 69 bytes for the second line, and a CRLF.  Repeat this through
the whole header, then add another final CRLF.  The literal length
count has to match that total *exactly*.

The other thing to realize is that as soon as there's a parsing
problem, it's likely to cascade and turn into an infinite number of
parsing problems because the client and server are completely out of
sync.

Another hint: It would help you a great deal to have protocol logging
in your client, in addition to relying on the server logging.  If you
have a clear record of what you sent and how you got there, it could
show errors more clearly, especially once Outlook becomes confused by
what you sent it.

Barry

On Thu, Jun 14, 2018 at 12:34 AM, sayantan pal <sayantan.pal19@gmail.com> wrote:
> Dear Chris,
>
>         This is being a client server conversation:
>
> client: xx UID FETCH 2:8 (UID FLAGS RFC822.SIZE BODY.PEEK[HEADER])
> server: * 1 FETCH (UID 2 FLAGS (\SEEN) RFC822.SIZE 4794 BODY[HEADER] {4348}
> X-Recent: Recent
> Received: by mail-lf0-f48.google.com with SMTP id n15-v6so29788633lfn.10
> for <A@cogitomail.com>; Mon, 11 Jun 2018 03:47:22 -0700 (PDT)
> MIME-Version: 1.0
> From: sayantan pal <sayantan.pal19@gmail.com>
> Date: Mon, 11 Jun 2018 16:17:04 +0530
> Message-ID:
> <CACsjV1wAbBpE2dJ_xzB6qUf2O2nsXsqqGuufLd=zG0L13TXeQA@mail.gmail.com>
> Subject: 2
> To: A <A@cogitomail.com>
> Content-Type: multipart/alternative; boundary="0000000000006f01d7056e5b788f"
>
>
> )
>
> This reply is somehow wrong w.r.t a server reply and I am getting parse
> error from Outlook. I am attaching a .msg file which my server received by
> the smtp service I have developed. Please check. I have not written all the
> headers in this mail. I am retrieving all the header using mailbee
> extension. It has a property named RawHeaders which retrieves all the
> headers.
>
> Thank You,
> Sayantan Pal
>
> On Wed, Jun 13, 2018 at 11:49 PM, Chris Newman <chris.newman@oracle.com>
> wrote:
>>
>> Implementing a mail server is probably much harder than you think it is.
>> Good luck!
>>
>> I recommend using an IMAP client that provides good diagnostics for
>> testing.. Some programming languages, such as Python, include a limited IMAP
>> client library you can use for simple testing.
>>
>>                 - Chris
>>
>>
>> On 13 Jun 2018, at 5:29, sayantan pal wrote:
>>
>>>  Dear Team,
>>>
>>>     I am implementing my own mail server and thereby developing IMAP
>>> service by own following RFC3501 and 1705. I am unable to implement the
>>> IMAP fetch header and body command. I am using Outlook 2007 as email
>>> client. I have the log file for reference. I thereby requesting for your
>>> kind support to successfully fetch the header and body of a mail.
>>>
>>> Thanking You,
>>> Sayantan Pal
>>> _______________________________________________
>>> imapext mailing list
>>> imapext@ietf.org
>
>
>
> _______________________________________________
> imapext mailing list
> imapext@ietf.org
> https://www.ietf.org/mailman/listinfo/imapext
>