Skip to content

IMAP APPEND example is wrong #10300

Closed
Closed

Description

@bohwaz

The IMAP APPEND example has this part:

    /* This will create a new message 100. Note that you should perform an
     * EXAMINE command to obtain the UID of the next message to create and a
     * SELECT to ensure you are creating the message in the OUTBOX. */
    curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/100");

But it is wrong:

  1. you don't need to pass the message UID to do an APPEND, but you need to pass the folder name, so the URL should be imap://imap.example.com/Sent. In fact there is no UID used in the imap_perform_append function
  2. Curl is already doing a SELECT in its append function, so there is no need to do a SELECT

This can lead to some confusion when the example is wrong :)

Thanks!

Activity

  1. jay commented on Jan 16, 2023

    @jay
    Member

    Is this true of IMAP protocol or just the server you are using?

    /cc @captain-caveman2k

  2. bagder commented on Feb 9, 2023

    @bagder
    Member

    No response, closing.

  3. bohwaz commented on Feb 9, 2023

    @bohwaz
    Author

    You didn't give me enough time to reply @bagder :)

    @jay This is not related to the IMAP protocol, this is what the curl code is doing. Curl IMAP code for APPEND is never using the UID: https://github.com/curl/curl/blob/master/lib/imap.c#L763-L826

    Everything is in my original message :)

  4. reopened this on Feb 9, 2023
  5. bagder commented on May 16, 2023

    @bagder
    Member

    okay @bohwaz so can you please tell us what you think the fix is? Perhaps with a PR for the example?

  6. bohwaz commented on May 16, 2023

    @bohwaz
    Author

    Hi @badger yes :)

    The mentioned lines should be replace by this:

        /* This will create a new message in folder "Sent". */
        curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/Sent");
    
  7. added a commit that references this issue on Jul 19, 2023
    469f3d8
  8. added a commit that references this issue on Sep 25, 2023
    d38a2c8
  9. added a commit that references this issue on Mar 27, 2024
    9bf89bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions