Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Discover how to use COI



COI Principles

The principle of COI is very simple: COI uses IMAP/SMPT as the transport mechanism for a chat application.

The generic steps are as follows:

  1. Establish a connection with an SMTP server (Send) and an IMAP server (Receive)
  2. Establish the capabilities of the IMAP server. This determines how you communicate with it
  3. Send chat messages over SMPT, receive messages over IMAP


COI Now & Soon

Content text explaining simple COI and IMAP extended COI.


Required Knowledge

To build a COI application you need to know the following:

  • How to communicate with and IMAP and SMPT server - This is usually done by using a native email library.

A basic understanding of the structure of SMTP/IMAP messages - Specifically an working knowledge of RFC 5322, but reading the COI protocol should give you most of what you need.

  • A good understanding of the COI protocol in both its variants (COI over simple IMAP servers and COI over COI extended IMAP servers).
  • Know how to build your desired application. 


What you need

As a client developer, you have several options:

  • Communicate with the email server using an IMAP library for your preferred language & platform – or even communicate directly when you feel adventurous.
  • Base your work on Delta Chat Core, an MPL licensed library that abstracts away IMAP communication and that will become COI compliant.
  • Base your work on an existing COI compatible app, like the cross-platform OX Talk app.


Hello COI World

To create a simple “Hello World” example app you can follow this basic tutorial.

This will not cover any specific platform or language details. This will be left to you.

You will need the following:

  • Your preferred development environment and knowledge about how to use it.
  • An installed and tested email communication library that will let you communicate with SMTP and IMAP
  • Access and login credentials (if needed) to an IMAP and SMTP server.

First check your SMTP connection

This example uses an Apple Mac Terminal Session to connect to a gmail SMTP server:


> openssl s_client -connect smtp.gmail.com:465

CONNECTED(00000006)

depth=1 C = US, O = Google Trust Services, CN = Google Internet Authority G3

verify error:num=20:unable to get local issuer certificate

verify return:0

---

Certificate chain

 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=smtp.gmail.com

[and lots more stuff]

---

220 smtp.gmail.com ESMTP w18sm33115850wmi.12 - gsmtp

 

> EHLO Mike [Mike can be anything]

250-smtp.gmail.com at your service, [185.91.231.176]

250-SIZE 35882577

250-8BITMIME

250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH

250-ENHANCEDSTATUSCODES

250-PIPELINING

250-CHUNKING

250 SMTPUTF8

> AUTH PLAIN AE9MTM

[Get AE9MTM from this “echo -ne '\00<YourEmail@gmail.com>\00<YourPassword>' | base64”]

235 2.7.0 Accepted

 

>> MAIL FROM: <ABC@gmail.com>  [ABC@gmail.com is the from email address]

250 2.1.0 OK k26sm29754989wmi.28 - gsmtp

 

>> rcpt to: <XYZ@gmail.com> [XYZ@gmail.com is the recipients email address]

250 2.1.0 OK w12sm82801761wrr.23 - gsmtp

 

>>DATA

354  Go ahead m4sm74187003wmi.3 - gsmtp

 

Subject: it works

yay!

[CTRL+V+ENTER] [Normally a blank line is ok, but sometimes you need this]

. [CTRL+V+ENTER] [Normally a dot is ok, but sometimes you need this]

 

 

250 2.0.0 OK 1548086275 m4sm74187003wmi.3 - gsmtp

 

>> quit

221 2.0.0 closing connection m4sm74187003wmi.3 - gsmtp

 

The recipient should receive the email.

If the recipient receives the email then you can now enter your development environment. 


What Next?

Content text, what could be done next to the Hello COI World example?

How We Can Help

If you have questions, you can post a question on Stackoverflow using the #coi tag or add an issue on our Github project.


  • No labels