All Projects → karastojko → Mailio

karastojko / Mailio

Licence: other
mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols. It is based on standard C++ 17 and Boost library.

Projects that are alternatives of or similar to Mailio

Vmime
VMime Mail Library
Stars: ✭ 218 (+31.33%)
Mutual labels:  library, smtp, imap
James Project
Emails at the heart of your business logic!
Stars: ✭ 485 (+192.17%)
Mutual labels:  smtp, imap
Neutron
Self-hosted server for the ProtonMail client
Stars: ✭ 452 (+172.29%)
Mutual labels:  smtp, imap
Hydroxide
A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge
Stars: ✭ 578 (+248.19%)
Mutual labels:  smtp, imap
Mailkit
A cross-platform .NET library for IMAP, POP3, and SMTP.
Stars: ✭ 4,477 (+2596.99%)
Mutual labels:  smtp, imap
Greenmail
Official master for the Greenmail project
Stars: ✭ 424 (+155.42%)
Mutual labels:  smtp, imap
Mail
💌 Mail app for Nextcloud
Stars: ✭ 528 (+218.07%)
Mutual labels:  smtp, imap
Rainloop Webmail
Simple, modern & fast web-based email client
Stars: ✭ 3,618 (+2079.52%)
Mutual labels:  smtp, imap
Docker Mailserver
Production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) running inside a container.
Stars: ✭ 8,115 (+4788.55%)
Mutual labels:  smtp, imap
Esp32 Mail Client
The complete and secured Mail Client for ESP32, sending and reading the E-mail through the SMTP and IMAP servers.
Stars: ✭ 79 (-52.41%)
Mutual labels:  smtp, imap
Mnm
The legitimate email replacement — n-identity, decentralized, store-and-forward, open protocol, open source. (Server)
Stars: ✭ 162 (-2.41%)
Mutual labels:  smtp, imap
Laravel Imap
Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.
Stars: ✭ 416 (+150.6%)
Mutual labels:  library, imap
Mail
Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.
Stars: ✭ 399 (+140.36%)
Mutual labels:  smtp, imap
Twisted
Event-driven networking engine written in Python.
Stars: ✭ 4,442 (+2575.9%)
Mutual labels:  smtp, imap
Mailcow Dockerized
mailcow: dockerized - 🐮 + 🐋 = 💕
Stars: ✭ 4,573 (+2654.82%)
Mutual labels:  imap, smtp
Deltachat Desktop
Email-based instant messaging for Desktop.
Stars: ✭ 526 (+216.87%)
Mutual labels:  smtp, imap
Eventum
Eventum Issue Tracking System
Stars: ✭ 120 (-27.71%)
Mutual labels:  smtp, imap
Excision-Mail
Fullstack, security focused mailserver based on OpenSMTPD for OpenBSD using ansible
Stars: ✭ 108 (-34.94%)
Mutual labels:  imap, smtp
Deltachat Core Rust
Delta Chat Rust Core library, used by Android/iOS/desktop apps and bindings
Stars: ✭ 300 (+80.72%)
Mutual labels:  smtp, imap
Cypht
Cypht: Lightweight Open Source webmail written in PHP and JavaScript
Stars: ✭ 628 (+278.31%)
Mutual labels:  smtp, imap

mailio

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.

Examples

To 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 is created by constructing smtp (or smtps) class. The message is sent over the connection:

message msg;
msg.from(mail_address("mailio library", "[email protected]"));
msg.add_recipient(mail_address("mailio library", "[email protected]"));
msg.subject("smtps simple message");
msg.content("Hello, World!");

smtps conn("smtp.gmail.com", 587);
conn.authenticate("[email protected]", "mailiopass", smtps::auth_method_t::START_TLS);
conn.submit(msg);

To 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. If POP3 is used, then instance of pop3 (or pop3s) class is created and message is fetched:

pop3s conn("pop.mail.yahoo.com", 995);
conn.authenticate("[email protected]", "mailiopass", pop3s::auth_method_t::LOGIN);
message msg;
conn.fetch(1, msg);

Receiving a message over IMAP is analogous. Since IMAP recognizes folders, then one has to be specified, like inbox:

imaps conn("imap.gmail.com", 993);
conn.authenticate("[email protected]", "mailiopass", imap::auth_method_t::LOGIN);
message msg;
conn.fetch("inbox", 1, msg);

More advanced features are shown in examples directory, see below how to compile them.

Note for Gmail users: if 2FA is turned on, then instead of the primary password, the application password must be used. Follow Gmail instructions to add mailio as trusted application and use the generated password for all three protocols.

Note for Zoho users: if 2FA is turned on, then instead of the primary password, the application password must be used. Follow Zoho instructions to add mailio as trusted application and use the generated password for all three protocols.

Requirements

Mailio library is supposed to work on all platforms supporting C++ 17 compiler, recent Boost libraries and CMake build tool.

For Linux the following configuration is tested:

  • gcc 8.3.0.
  • Boost 1.66 with Regex, Date Time available.
  • POSIX Threads, OpenSSL and Crypto libraries available on the system.
  • CMake 3.16.3

For MacOS the following configuration is tested:

  • Apple LLVM 9.0.0.
  • Boost 1.66.
  • OpenSSL 1.0.2n available on the system.
  • CMake 3.16.3.

For Microsoft Windows the following configuration is tested:

  • Windows 10.
  • Visual Studio 2019 Community Edition.
  • Boost 1.71.0.
  • OpenSSL 1.0.2n available on the system.
  • CMake 3.17.3.

Setup

Ensure that OpenSSL, Boost and CMake are in the path. If they are not in the path, one could use CMake options -DOPENSSL_ROOT_DIR and -DBOOST_ROOT 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 and include parameters of b2 script (after bootstrap finishes). Both static and dynamic libraries should be built in the build directory. If one wants to specify non-default installation directory say /opt/mailio, then use the CMake option -DCMAKE_INSTALL_PREFIX. Other available options are MAILIO_BUILD_SHARED_LIBRARY (by default is on, if turned off then the static library is built), MAILIO_BUILD_DOCUMENTATION (if Doxygen documentation is generated, by default is on) and MAILIO_BUILD_EXAMPLES (if examples are built, by default is on).

Linux, MacOS

From the terminal go into the directory where the library is downloaded to, and execute:

mkdir build
cd ./build
cmake ..
make install

Microsoft Windows

From the command prompt go into the directory where the library is downloaded, and execute:

mkdir build
cd .\build
cmake ..

A solution file will be built, open it from Visual Studio and build the project.

Features

  • Recursive formatter and parser of the MIME message.
  • MIME message recognizes the most common headers like subject, recipients, content type and so on.
  • Encodings that are supported for the message body: Seven bit, Eight bit, Binary, Base64 and Quoted Printable.
  • Subject, attachment and name part of the mail address can be in ASCII or UTF-8 format.
  • All media types are recognized, including MIME message embedded within another message.
  • MIME message has configurable line length policy and strict mode for parsing.
  • SMTP implementation with message sending. Both plain and SSL (including START TLS) versions are available.
  • POP3 implementation with message receiving and removal, getting mailbox statistics. Both plain and SSL (including START TLS) versions are available.
  • IMAP implementation with message receiving, removal and search, getting mailbox statistics, managing folders. Both plain and SSL (including START TLS) versions are available.

Issues

The 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 contact me. Here is a list of issues known so far and planned to be fixed in the future.

  • Non-ASCII subject is assumed to be UTF-8.
  • Non-ASCII attachment name is assumed to be UTF-8.
  • Header attribute cannot contain space between name and value.
  • SSL certificate is not verified.
  • SSL version not configurable (v2.3 hardcoded).

Contributors

Contact

In 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].