curl / Mailing Lists / curl-users / Single Mail


Looping though an IMAP-Folder, batch freezes

From: Axel Humcke <>
Date: Wed, 6 Mar 2019 12:37:46 +0100


first at all i must say that i am completely new to curl.

I want to use it as follows:
- Connect to an IMAP-Folder
- Loop Through the folder and export every email to a text file.

Therefor I am creating and running the following .bat-file from an
MS-Access-Application (VBA) with WshShell.Exec:

/set Timestamp=2019-03-06_12-15-38_80//
//for /l %%x in (2, 1, 69) do (//
//curl --insecure --url "imaps://;UID=%%x"
--netrc-file [Path-to-file] -o cURL_FetchEmail_%Timestamp%_UID_%%x.txt//
//move [Source-path]\cURL_FetchEmail_%Timestamp%_UID_%%x.txt
//curl --insecure --url "imaps://;UID=%%x"
--netrc-file [Path-to-file] -X "UID STORE %%x -Flags \Deleted"//

If i start the .bat-file manually from the folder where it is created,
it runs without problems. But when i start it with VBA it freezes after
a few loops (The first few textfiles are created).

There sure is a better way to do this like looping through the
IMAP-Folder directly with the curl-command or sequence numbers? I didn't
really get along with the syntax.

Any help is appreciated.

Kind regards,

Received on 2019-03-06