jens-maus / yam

:mailbox_with_mail: YAM (short for 'Yet Another Mailer') is a MIME-compliant open-source Internet email client written for Amiga-based computer systems (AmigaOS4, AmigaOS3, MorphOS, AROS). It supports POP3, SMTP, TLSv1/SSLv3 connection security, multiple users, multiple identities, PGPv2/v5 encryption, unlimited hierarchical folders, an ARexx interface, etc...
https://yam.ch
GNU General Public License v2.0
61 stars 18 forks source link

IMAP 'download' support #583

Open jens-maus opened 8 years ago

jens-maus commented 8 years ago

Originally on 2014-09-19 00:22:59 +0200


Phenomenon

Since the IMAP protocol is a lot more complex than the POP3 protocol, it is also a lot more complicated to implement full IMAP synchronization support in short time. To be able to provide some first basic IMAP support to users a stripped down IMAP support should be implemented (so-called 'IMAP download') which should work essentially the same like the POP3 protocl. That means it should only download emails and provide functionality like simple POP3 download support.

Background analysis

For this to be implemented, the IMAP protocol needs to be analyzed so that only a few commands are used to list new waiting emails, to extract UIDL identifiers and to download new emails. All other functionality such as synchronizing the read status, etc. should be kept for the upcoming full IMAP support in YAM 3.0+.

Implementation recommendation

When implementing this 'IMAP download' support one should make sure that the future src/tcp/imap.c should already be prepared to provide full synchronization in future. That means, care should be taken not to implement such download support to basic but keep in mind to develop functions and functionality with synchronization support in mind. Furthermore, this functionality should always be advertised as "IMAP download" support and care needs to be taken to distinguish between full IMAP support (coming with YAM 3.0) and with such a basic "IMAP download" support.

aiobofh commented 10 months ago

@jens-maus curl is available for AmigaOS Classic (https://curl.se/download.html). Sure it's an older version. However. Looking at this: https://aminet.net/package/comm/tcp/curl-7.74.0 it looks at least a little bit fresher... And... It's supposed to support IMAP and IMAPS (Using AmiSSL), but it looks ixemul:ish. Could this help?

There are some examples on how to use the C-API here: https://curl.se/libcurl/c/example.html

Listing mail in a folder:

    curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
    curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");

    curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");

    res = curl_easy_perform(curl);

Downloading a mail:

    curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
    curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");

    curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");

    res = curl_easy_perform(curl);

... And so on.