98. Fetching emails using IMAP

The Internet Message Access Protocol (IMAP) is an internet protocol for retrieving email messages from an email server using TCP/IP. Most email server providers, including major ones like Gmail, Outlook.com, and Yahoo! Mail offer support for it. There are some C++ libraries for working with IMAP, such as VMIME, that is open source and cross-platform and supports IMAP, POP, and SMTP. However, in this book, I will use cURL (or more specifically, libcurl) to make HTTP requests to an email server using IMAPS.

The required operations can be achieved with several IMAP commands. In the following list, imap.domain.com is an example domain:

  • GET imaps://imap.domain.com retrieves all of the folders in the mailbox. If ...

Get The Modern C++ Challenge now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.