Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP APPEND example is wrong #10300

Closed
bohwaz opened this issue Jan 16, 2023 · 5 comments
Closed

IMAP APPEND example is wrong #10300

bohwaz opened this issue Jan 16, 2023 · 5 comments

Comments

@bohwaz
Copy link

bohwaz commented Jan 16, 2023

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!

@jay jay added the IMAP label Jan 16, 2023
@jay
Copy link
Member

jay commented Jan 16, 2023

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

/cc @captain-caveman2k

@bagder
Copy link
Member

bagder commented Feb 9, 2023

No response, closing.

@bagder bagder closed this as completed Feb 9, 2023
@bohwaz
Copy link
Author

bohwaz commented Feb 9, 2023

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 :)

@bagder bagder reopened this Feb 9, 2023
@bagder
Copy link
Member

bagder commented May 16, 2023

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

@bohwaz
Copy link
Author

bohwaz commented May 16, 2023

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");

@bagder bagder closed this as completed in 9bf89bd Jul 9, 2023
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
ptitSeb pushed a commit to wasix-org/curl that referenced this issue Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants