Accessing Gmail Sent Mail folder with libcurl

I’m having trouble using libcurl to access my Gmail Sent Mail folder. While I can retrieve emails from the inbox without issues, I’m stumped when it comes to folders with special characters.

Here’s what I’ve tried:

curltest.exe "imaps://mail.google.com:993/[Google Mail]/Outbox" --cert "mycert.pem" -u myemail:mypassword

This gives me an error about a bad URL format. I also tried the -g option:

curltest.exe "imaps://mail.google.com:993/[Google Mail]/Outbox" --cert "mycert.pem" -u myemail:mypassword -g

But I get a globbing error. How can I properly access folders with square brackets in their names using libcurl? Any suggestions would be appreciated!

hey lucask, have u tried URL encoding the folder name? might help with those pesky special chars. try something like this:

curltest.exe “imaps://mail.google.com:993/%5BGoogle%20Mail%5D/Outbox” --cert “mycert.pem” -u myemail:mypassword

let me kno if that works for ya!

I’ve encountered similar issues when working with Gmail’s IMAP folders. One thing to keep in mind is that Gmail’s folder structure can be a bit tricky, especially with localization. Instead of ‘[Google Mail]/Outbox’, you might want to try ‘[Gmail]/Sent Mail’ as the folder path.

Here’s what worked for me:

curltest.exe “imaps://imap.gmail.com:993/[Gmail]/Sent Mail” --ssl-reqd --cert “mycert.pem” -u myemail:mypassword

Make sure to use double quotes around the URL to avoid shell interpretation issues. Also, I found that using ‘imap.gmail.com’ instead of ‘mail.google.com’ was more reliable.

If you’re still having trouble, you might want to enable IMAP access in your Gmail settings if you haven’t already. Hope this helps!

I’ve dealt with similar IMAP issues before, and there’s a couple things to consider. First, Gmail’s folder names can vary based on your account’s language settings. Try using ‘[Gmail]/Sent Mail’ instead of ‘[Google Mail]/Outbox’.

Also, URL encoding is crucial. Here’s a command that worked for me:

curltest.exe “imaps://imap.gmail.com:993/%5BGmail%5D/Sent%20Mail” --ssl-reqd --cert “mycert.pem” -u myemail:mypassword

Notice the URL-encoded brackets and space. If that doesn’t work, double-check your SSL certificate and ensure IMAP is enabled in your Gmail settings. Let us know if you need more help troubleshooting.