{"id":33003020,"url":"https://github.com/karastojko/mailio","last_synced_at":"2025-11-18T08:03:16.028Z","repository":{"id":37663292,"uuid":"66216819","full_name":"karastojko/mailio","owner":"karastojko","description":"mailio is a cross platform C++ library for MIME format and SMTP, POP3, IMAP protocols. It is based on the standard C++ 17 and Boost library.","archived":false,"fork":false,"pushed_at":"2025-11-02T15:25:30.000Z","size":1055,"stargazers_count":456,"open_issues_count":26,"forks_count":115,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-11-02T16:18:47.636Z","etag":null,"topics":["c-plus-plus-11","email","imap","library","mime","pop3","smtp"],"latest_commit_sha":null,"homepage":"https://www.mailio.dev","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karastojko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-08-21T19:29:39.000Z","updated_at":"2025-11-02T15:25:34.000Z","dependencies_parsed_at":"2024-10-26T00:53:02.362Z","dependency_job_id":"21e829d0-09e1-4047-82ac-2778406b9fc3","html_url":"https://github.com/karastojko/mailio","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/karastojko/mailio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karastojko%2Fmailio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karastojko%2Fmailio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karastojko%2Fmailio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karastojko%2Fmailio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karastojko","download_url":"https://codeload.github.com/karastojko/mailio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karastojko%2Fmailio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285028340,"owners_count":27102545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-18T02:00:05.759Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus-11","email","imap","library","mime","pop3","smtp"],"created_at":"2025-11-13T14:00:38.907Z","updated_at":"2025-11-18T08:03:16.022Z","avatar_url":"https://github.com/karastojko.png","language":"C++","readme":"\n# mailio #\n\n![C++](https://img.shields.io/badge/C++-17-blue)\n![C++](https://img.shields.io/badge/C++-20-blue)\n[![License](https://img.shields.io/badge/License-MIT-darkgreen)](LICENSE)\n[![Conan Center](https://img.shields.io/conan/v/mailio)](https://conan.io/center/recipes/mailio)\n[![Vcpkg](https://img.shields.io/vcpkg/v/mailio)](https://vcpkg.io/en/package/mailio)\n![FreeBSD](https://img.shields.io/badge/OS-FreeBSD-870000)\n![Linux](https://img.shields.io/badge/OS-Linux-870000)\n![Windows](https://img.shields.io/badge/OS-Windows-870000)\n\n[中文文档](README_zh.md)\n\n*mailio* is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols. It is based on the standard C++ 17 and Boost library.\n\n\n# Examples #\n\nTo send a mail, one has to create `message` object and set it's attributes as author, recipient, subject and so on. Then, an SMTP connection\nis created by constructing `smtp` (~~or smtps~~) class. The message is sent over the connection:\n\n```cpp\nmessage msg;\nmsg.from(mail_address(\"mailio library\", \"mailio@gmail.com\"));\nmsg.add_recipient(mail_address(\"mailio library\", \"mailio@gmail.com\"));\nmsg.subject(\"smtp simple message\");\nmsg.content(\"Hello, World!\");\n\nsmtp conn(\"smtp.gmail.com\", 587);\nconn.authenticate(\"mailio@gmail.com\", \"mailiopass\", smtp::auth_method_t::LOGIN);\nconn.submit(msg);\n```\n\nTo receive a mail, a `message` object is created to store the received message. Mail can be received over POP3 or IMAP, depending of mail server setup.\nIf POP3 is used, then instance of `pop3` (~~or pop3s~~) class is created and message is fetched:\n\n```cpp\npop3 conn(\"pop.mail.yahoo.com\", 110);\nconn.authenticate(\"mailio@yahoo.com\", \"mailiopass\", pop3::auth_method_t::LOGIN);\nmessage msg;\nconn.fetch(1, msg);\n```\n\nReceiving a message over IMAP is analogous. Since IMAP recognizes folders, then one has to be specified, like *inbox*:\n\n```cpp\nimap conn(\"imap.gmail.com\", 143);\nconn.authenticate(\"mailio@gmail.com\", \"mailiopass\", imap::auth_method_t::LOGIN);\nmessage msg;\nconn.fetch(\"inbox\", 1, msg);\n```\n\nMore advanced features are shown in `examples` directory, see below how to compile them.\n\nNote for Gmail users: it might be needed to [register](https://support.google.com/accounts/answer/6010255) *mailio* as a trusted application. Follow the\n[Gmail instructions](https://support.google.com/accounts/answer/3466521) to add it and use the generated password for all three protocols.\n\nNote for Zoho users: if 2FA is turned on, then instead of the primary password, the application password must be used. Follow\n[Zoho instructions](https://www.zoho.com/mail/help/adminconsole/two-factor-authentication.html#alink5) to add *mailio* as trusted application and use the\ngenerated password for all three protocols.\n\n\n# Setup #\n\n*mailio* library is supposed to work on all platforms supporting C++ 17 compiler, Boost 1.81 or newer and CMake build tool. The platforms tested so far are\nLinux, Windows, FreeBSD, MacOS, Cygwin, MinGW and the compilers are Gcc, Microsoft Visual C++ and Clang.\n\nThere are several ways to build *mailio*: by cloning the [repo](https://github.com/karastojko/mailio.git) and using Cmake, by using Vcpkg or\n[xmake](https://xmake.io).\n\n\n## CMake ##\n\nEnsure that OpenSSL, Boost and CMake are in the path. If they are not in the path, one could use CMake options `-DOPENSSL_ROOT_DIR`, `-DBOOST_ROOT` and\n`Boost_INCLUDE_DIRS` to set them. Boost must be built with the OpenSSL support. If it cannot be found in the path, set the path explicitly via `library-path`\nand `include` parameters of `b2` script (after `bootstrap` finishes). Both static and dynamic libraries should be built in the `build` directory.\n\nIf one wants to specify a non-default installation directory, say `/opt/mailio`, then the option `-DCMAKE_INSTALL_PREFIX` should be used. If a user does not have\nprivileges for the default directories, then it must specify one by using this CMake variable.\n\nOther available options are `BUILD_SHARED_LIBS` (whether a shared or static library shall be built, by default a shared lib is built),\n`MAILIO_BUILD_DOCUMENTATION` (if Doxygen documentation is generated, by default is on) and `MAILIO_BUILD_EXAMPLES` (if examples are built, by default is on).\n\n\n### Linux, FreeBSD, MacOS, Cygwin ###\n\nFrom the terminal go into the directory where the library is downloaded to, and execute:\n```\nmkdir build\ncd ./build\ncmake ..\nmake install\n```\nInstalling the project ensures that the test project has also the auxiliary files copied, required by several tests.\n\n\n### Microsoft Windows/Visual Studio ###\n\nFrom the command prompt go into the directory where the library is downloaded, and execute:\n```\nmkdir build\ncd .\\build\ncmake ..\n```\nA solution file will be built, open it from Visual Studio and build the project. To install it, build the `INSTALL` project of the *mailio* solution, it copies\nalso auxiliary files required by several tests.\n\n\n### Microsoft Windows/MinGW ###\n\nOpen the command prompt by using the `open_distro_window.bat` script, and execute:\n```\nmkdir build\ncd .\\build\ncmake.exe .. -G \"MinGW Makefiles\"\nmake install\n```\n\n\n## Vcpkg ##\n\nInstall [Vcpkg](https://github.com/microsoft/vcpkg) and run:\n```\nvcpkg install mailio\n```\nTests are not available as an option in this case. Use the CMake way to build them.\n\n\n# Features #\n\n* Recursive formatter and parser of the MIME message.\n* MIME message recognizes the most common headers like subject, recipients, content type and so on.\n* Message body encodings that are supported: Seven bit, Eight bit, Binary, Base64 and Quoted Printable.\n* Header encodings that are supported: ASCII, UTF-8, Base64, Quoted Printable.\n* Header attributes encodings that are supported: ASCII, Base64, Quoted Printable, Percent.\n* String charset configurable for headers and their attributes.\n* All media types are recognized, including MIME message embedded within another message.\n* MIME message has configurable line length policy and strict mode for parsing.\n* SMTP implementation with message sending. Both plain and SSL (including START TLS) versions are available.\n* POP3 implementation with message receiving and removal, getting mailbox statistics. Both plain and SSL (including START TLS) versions are available.\n* IMAP implementation with message receiving, removal and search, getting mailbox statistics, managing folders. Both plain and SSL (including START TLS)\n  versions are available.\n\n\n# Issues and improvements #\n\nThe library is tested on valid mail servers, so probably there are negative test scenarios that are not covered by the code. In case you find one, please\ncontact me. Here is a list of issues known so far and planned to be fixed in the future.\n\n* MIME header attributes not fully implemented.\n* IMAP supports only ASCII folder names.\n* IMAP lacks the idle support.\n* Editing parts of a message.\n* IMAP flags.\n* Asynchronous I/O.\n* More descriptive error messages.\n* External initialization of the SSL context.\n\n\n# Contributors #\n\nThanks to all people who contribute to the project by improving the source code, report problems and propose new features. Here is a list from the Git history,\nin case I missed someone please let me know.\n\n* [Trevor Mellon](https://github.com/TrevorMellon): CMake build scripts.\n* [Kira Backes](mailto:kira.backes[at]nrwsoft.de): Fix for correct default message date.\n* [sledgehammer_999](mailto:hammered999[at]gmail.com): Replacement of Boost random function with the standard one.\n* [Paul Tsouchlos](mailto:developer.paul.123[at]gmail.com): Modernizing build scripts.\n* [Anton Zhvakin](mailto:a.zhvakin[at]galament.com): Replacement of deprecated Boost Asio entities.\n* [terminator356](mailto:termtech[at]rogers.com): IMAP searching, fetching messages by UIDs.\n* [Ilya Tsybulsky](mailto:ilya.tsybulsky[at]gmail.com): MIME parsing and formatting issues. UIDL command for POP3.\n* [Ayaz Salikhov](https://github.com/mathbunnyru): Conan packaging.\n* [Tim Lukas Harken](tlh[at]tlharken.de): Removing compilation warnings.\n* [Rainer Sabelka](mailto:saba[at]sabanet.at]): SMTP server response on accepting a mail.\n* [David Garcia](mailto:david.garcia[at]antiteum.com): Vcpkg port.\n* [ImJustStokedToBeHere](https://github.com/ImJustStokedToBeHere): Typo error in IMAP.\n* [lifof](mailto:youssef.beddad[at]gmail.com): Support for the MinGW compilation.\n* [Canyon E](https://github.com/canyone2015): IMAP folder delimiter static variable issue.\n* [ostermal](https://github.com/ostermal): Bug with the horizontal tab in MIME headers.\n* [MRsoymilk](mailto:313958485[at]qq.com): Bug in the sending attachment example.\n* [Don Yihtseu](https://github.com/tsurumi-yizhou): Add Chinese ReadMe.\n* [Leonhard Kipp](mailto:Leonhard.Kipp[at]ppro.com): Proper way to build the shared library. Message formatting options. Optional message subject.\n* [Orchistro](https://github.com/orchistro): Improving CMake build script.\n* [Abril Rincón Blanco](mailto:git[at]rinconblanco.es): Compilation fix for Clang earlier than the version 14.\n* [yjm6560](https://github.com/yjm6560): Various IMAP bugs.\n* [Hannah Sauermann](mailto:hannah.sauermann[at]seclous.com): Fix for the `stringstream` usage in older standard libraries.\n* [Matheus Gabriel Werny](mailto:matheusgwdl[at]protonmail.com): CMake fixes and improvements.\n* [stitch3210](https://github.com/stitch3210): Case insensitive headers.\n* [Luigi Masdea](luigimasdea0[at]gmail.com): Typo error.\n* [Charlie Wolf](charlie[at]wolf.is): Additional attributes in the content type.\n\n\n# References #\n\n* [RFC 822](http://www.rfc-editor.org/rfc/rfc822): Standard for the Format of ARPA Internet Text Messages.\n* [RFC 1939](http://www.rfc-editor.org/rfc/rfc1939): Post Office Protocol - Version 3\n* [RFC 2045](http://www.rfc-editor.org/rfc/rfc2045): Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies\n* [RFC 2046](http://www.rfc-editor.org/rfc/rfc2046): Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types\n* [RFC 2047](http://www.rfc-editor.org/rfc/rfc2047): MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text\n* [RFC 2177](http://www.rfc-editor.org/rfc/rfc2177): IMAP4 IDLE command\n* [RFC 2183](http://www.rfc-editor.org/rfc/rfc2183): Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field\n* [RFC 2231](http://www.rfc-editor.org/rfc/rfc2231): MIME Parameter Value and Encoded Word Extensions: Sets, Languages, and Continuations\n* [RFC 2449](http://www.rfc-editor.org/rfc/rfc2449): Extension Mechanism\n* [RFC 3501](http://www.rfc-editor.org/rfc/rfc3501): Message Access Protocol - Version 4rev1\n* [RFC 5321](http://www.rfc-editor.org/rfc/rfc5321): Simple Mail Transfer Protocol\n* [RFC 5322](http://www.rfc-editor.org/rfc/rfc5322): Internet Message Format\n* [RFC 5987](http://www.rfc-editor.org/rfc/rfc5987): Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters\n* [RFC 6532](http://www.rfc-editor.org/rfc/rfc6532): Internationalized Email Headers\n\n\n# Contact #\n\nIn case you find a bug, please drop me a mail to contact (at) alepho.com. Since this is my side project, I'll do my best to be responsive.\n","funding_links":[],"categories":["Networking","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarastojko%2Fmailio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarastojko%2Fmailio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarastojko%2Fmailio/lists"}