Projects/xomail: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
(132 intermediate revisions by 7 users not shown)
Line 1: Line 1:
I welcome your comments and feedback on the [[Talk:Projects/xomail|Talk page]].
This page is geared towards Summer of Code 2008 work on an email activity. [[User:Shikhar|I]] am convinced it is possible to develop a functional and usable email client that implements a core feature set in the 10-week period that Google kindly sponsors.


:'''I used to write on the status of the project on [[User:Shikhar/Worklog|my worklog]]. It was dormant for a while and I have now resumed development, with the new repository being http://git.sugarlabs.org/projects/sweetmail''' [[User:Shikhar|Shikhar]] 20:40, 18 January 2009 (UTC)
I welcome your comments and feedback on the [[Talk:SOC Proposal/Email_Activity|Talk page]].


Abandoned for now [[Special:Contributions/212.201.44.249|212.201.44.249]] 23:54, 12 May 2009 (UTC)
== Introduction ==


== Abstract ==
Currently there is a Gmail activity but no real email client that can be used in Sugar. The possibility of accessing/composing emails offline does not exist. An email client with mesh integration like direct sending to mesh buddies and other fancy features would be great, but the basic groundwork of a usable email activity is needed.


Currently the XO ships with a Gmail activity that launches Browse in Gmail. Disconnected operation has however not been addressed.
Collaboration tools are a very important part of the OLPC software bundle and an activity which brings email to the XO desktop and ties in with the environment would be a very useful addition.

Collaboration tools are a very important part of the OLPC software bundle and an activity which brings email to the XO desktop and ties in with the environment would be a very useful addition. An email client with mesh integration like direct sending to mesh buddies and other fancy features would be great, but the basic groundwork of a usable email activity is needed.

This project will aim at the development of an email activity which is functional and usable for children, and provides the necessary features. Furthermore a daemon which facilitates background tasks like sending/receiving when internet access is available will be developed.


== Background ==
== Background ==


* Dead [[Email]] project and related discussion [[Talk:Email]]
* Dead [[Email]] project and related discussion [[Talk:Email]]
* Notes from a former OLPC intern examining different email clients and recommendations. [http://dev.laptop.org/git?p=users/jrus/email-spec;a=blob;f=email-spec.text;hb=HEAD]
* Draft specification from a former OLPC intern, also looking at how different email clients implement functionality. [http://dev.laptop.org/git?p=users/jrus/email-spec;a=blob;f=email-spec.text;hb=HEAD]
: I mostly agree with the specs, and I have incorporated ideas which would be implementable in the summer.
* [[Tinymail]] has an email client that could do with better Sugar integration
* The [[Tinymail]] framework has a demo, proof-of-concept email client for OLPC.


== Use cases ==
== Use cases ==


In general the use cases of an email client for OLPC users should be quite clear :-)
<todo>

* collaborating on projects
* sending/receiving attachments
* pen pals
* participating in discussions on mailing lists


== Deliverables ==
== Deliverables ==
Line 24: Line 34:


* A lightweight, functional email client with a child-friendly GUI
* A lightweight, functional email client with a child-friendly GUI
* A daemon should be developed for sending of unsent messages and receiving of new email. [The rationale behind this is we can't assume the child will open the email activity when internet access is available.]
* A daemon for sending of unsent messages and receiving of new email. [The rationale behind this is we can't assume the child will open the email activity when internet access is available.]


Other requisites:
Other requisites:
Line 35: Line 45:
* Should be able to handle large volumes of email and generally perform well
* Should be able to handle large volumes of email and generally perform well


== Approach ==
== Design principles ==

* Disconnected operation
* Lean and mean
* Ease of use: functionality without complicating
* Should lay groundwork for future development, and towards that - sane decisions, sane code, sane UI

== Ideas ==

=== Tinymail ===

The [http://tinymail.org/ Tinymail] framework provides a very flexible [http://www.tinymail.org/API/libtinymail-1.0/ API] for the creation of an email client, and is ideally suited for the XO.


=== Email organization ===
=== Email organization ===
Line 43: Line 64:
The Journal already uses tags, and for this activity I would like to extend them to have a visual representation as a GTK widget. They should be easily managed visually, for example dragging-and-dropping a tag onto a message should apply it.
The Journal already uses tags, and for this activity I would like to extend them to have a visual representation as a GTK widget. They should be easily managed visually, for example dragging-and-dropping a tag onto a message should apply it.


=== Email sending/receiving, MIME-parsing and message construction ===
=== Email sending/receiving, MIME handling ===


libtinymail-camel is an adaptation of the camel library which is developed by the Evolution team and as such offers tried-and-tested support for POP, SMTP, IMAP and TLS, as well as MIME handling.
A pure-Python client is possible
* email module for can be used for MIME parsing of incoming email, and message construction.
* smtplib, poplib, imaplib can be utilized for email sending/receiving.

An alternative is to use Python/pygtk for just the GUI and rely on [http://www.go-evolution.org/Camel libcamel] or [[Tinymail]] (which also builds upon libcamel). Tinymail already has Python bindings.


=== Storage ===
=== Storage ===


Tinymail offers maildir support, and the idea is to use a single maildir folder for all messages, and store tag-UID associations in a sqlite database. Headers will also be cached in the database, since this will be a common query. Towards this a good database schema that takes performance into consideration will be used.
Develop an abstraction layer for storage-related requests.


An abstraction layer for storage-related requests that cleanly combines Tinymail's methods with the database will be developed.
It seems to me that traditional mailbox formats like mbox, maildir; are not very suitable if email is organized around tags.

sqlite can be used for storage in a database. Using a database for email storage is not a new idea, here is an account of someone's successful experiment for his purposes: http://www.sqlite.org/cvstrac/wiki?p=ExperimentalMailUserAgent. I have examined this client and it is a proof-of-concept that convinced me.

The database schema would of course have to be very well thought out. There can be several tables in the database so that, for example, large blob's of email content do not impact scanning of email metadata.


=== Service descriptors ===
=== Service descriptors ===


To make it easy and extensible to configure on first run for services such as Gmail, a file format for a service descriptor can be formalized.
To make it easy and extensible to configure on first run for services such as Gmail, a file format for 'service descriptors' can be formalized.


The service descriptor would contain details about servers, protocols, junk-headers provided by the service, etc. Thus the only information required upon selection of a service should be username and password.
The service descriptor would contain details about servers, protocols, junk-headers provided by the service, etc. Thus the only information required upon selection of a service should be username and password.
Line 69: Line 82:
It should be possible to specify certain details in the service descriptor such as whether the service sets SpamAssassin headers, which IMAP folders are not to be downloaded. For example the Gmail service descriptor could specify that email in the 'All Mail', 'Spam' and 'Trash' folder is not to be downloaded, and that other folder names are to be interpreted as tags, since Gmail provides IMAP.
It should be possible to specify certain details in the service descriptor such as whether the service sets SpamAssassin headers, which IMAP folders are not to be downloaded. For example the Gmail service descriptor could specify that email in the 'All Mail', 'Spam' and 'Trash' folder is not to be downloaded, and that other folder names are to be interpreted as tags, since Gmail provides IMAP.


=== Search, Filters, Smart tags ===
=== Search back-end ===


Having a flexible, efficient, and robust search back end would have many benefits for this activity.
Having a flexible, efficient, and robust search back end would have many benefits for this activity.


Something interesting would be to formalize a common grammar for searches, filters and smart tags. For example, to be able to search for "received:today", and also as easily create a smart tag called "today's email" using that string, or create a filter that applies tag "papa" to all emails I receive with "from:dad at smthn.org". This task will be executed in the interim period before SOC.
I propose formalizing a common grammar for searches, filtering criteria and smart tag criteria. For example, to be able to search for <tt>received:today</tt>, and also as easily create a smart tag called "today's email" using that string, or create a filter that applies tag "papa" to all emails I receive with <tt>from:dad@smthn.org</tt>.


While it's probably not beyond kids to pick up a simple domain specific language ;-), the UI for these tasks should be easy-to-use for constructing these search strings.
The UI for the tasks of searching, filter creation and smart tag creation (which should be as intuitive as possible), can then construct these strings. Ultimately I expect kids will pick up our simple domain specific language and prefer to enter the criteria directly than take to graphical mechanisms for specifying these strings.


==== Search ====
'''Search'''


Some use cases would be perhaps more descriptive of how I would like to implement search:
For full text search, an option is to index incoming email with the sqlite fts module. This could potentially be expensive in terms of flash space (tbd)
* I want to search all my email for the word "brinjal". I could just type in the keyword directly, erasing the <tt>tag:<name></tt> qualifier for the currently selected tag, and type in "brinjal", and I would get results based on full text search of all email. Or I could have selected the smart tag "all email", and then appended to the search bar my keyword.
* I select the tag <tt>lkml</tt>. The search bar now shows <tt>tag:lkml</tt> and messages for that tag are displayed. I want to filter the display to emails only from a Linus Torvalds. So I append to the search bar and make it <tt>tag:lkml from:linus</tt> and search. I could also have clicked on a drop down button and selected 'From' and proceeded to type in <tt>linus</tt> to achieve the same.


The default action on an empty search bar and typing in some keywords should be full text search of all email. In case a tag qualifier is present, only emails from that tag are searched. Searching on the basis of headers would not present much problem, and this can even be easily indexed using the sqlite fts module. Full text search would likely have to be performed on demand as indexing all email would be expensive in terms of flash space.
==== Filters ====


'''Filters'''
Filters are rules that are applied to incoming email. It should be easy to specify filters in the user interface. A big use of filters is mailing lists and to that extent there should be automatic tagging based on mailing list headers.


Filters are rules that are applied post-retrieval to email. It should be easy to specify filters in the user interface. The UI can transform the user's criteria and action to be applied into an extension of the search grammar. For matching against the criteria the search back-end can be used and the action applied on retrieval if the message matches.
==== Smart tags ====


:<tt>header:"X-MailScanner-SpamCheck".starts:"sssss" | tag:spam untag:inbox | name:"spam assassin headers"</tt>
Smart tags as first class tags, except they can't be applied to messages since they are dynamically evaluated for the query they represent, and in that sense are like a saved search. It can be made possible to 'keep' a search as a smart tag. This is an optional but should not be very hard to implement.
:''An example of how a filtering rule for SpamAssassin headers may be stored''


Here the format is <tt>criteria | actions | metadata</tt>. Supported actions can be: tag, untag, erase, forward.
=== Notes on other features ===


'''Smart tags'''
==== Message Threading ====


Smart tags as first class tags, except they can't be applied to messages since they are dynamically evaluated for the query they represent, and in that sense are like a saved search. It can be made possible to 'keep' a search as a smart tag. Smart tags should not be very hard to implement provided the search back-end is developed as planned.
jwz's threading algorithm [http://www.jwz.org/doc/threading.html] can be used. It was proposed in the imapext-thread Internet Draft. There is also some python code for the same.[http://www.amk.ca/python/code/jwz]


:<tt>received:today status:unread | "today's unread email"</tt>
It should be possible for the user to manually thread by drag-and-drop where the algorithm gets it wrong.
:''An example of how a smart tag may be stored by the activity''

==== Spam filtering ====

In this stage of development I think it would be best to 'outsource' the spam filtering. So SpamAssassin headers can be supported. Using POP/IMAP with Gmail, spam is already filtered out by Gmail.

==== Contacts ====

A simple address book should be implemented for address auto-completion. Can later be made more of a real address book, or share data with a (future?) contacts activity.


=== User Interface ===
=== User Interface ===


''I am happy have to have the volunteer help of a student of Information and Digital Design with SVG icons and usability suggestions.''
<todo>

== Language of choice ==


The activity will have an intuitive and discoverable user interface in light of children.
A request on the [[Email]] page for a recursive name got an [[Talk:Email#got_a_recursive_name_for_you|interesting reply]]: GUBOP Underperforms Because Of Python. While this might be an apt comment, I have a feeling that a well-designed Python activity can perform decently even in the context of an email client.


Currently as I visualize what I want to develop; I foresee four main tabs: for writing email, for reading email, for managing contacts, and for configuration.
I favor Python since the functionality would be relatively easier to implement thanks to its RFC-compliant email libraries and bindings for sqlite. This would enable me to focus on usability as well. (The daemon can be coded in C and only fire up a Python interpreter when internet access is available). If my mentor is in agreement with this approach, I would definitely make clean abstractions so that if performance does indeed turn out to be an issue, the code can be adapted.
So:
: [Write] [Read] [Contacts] [Configure]


Associated icons for these tabs will be displayed in the icon toolbar.
But I have much more experience working with C and C++, so I am also open to relying on the great work of open-source email projects and implementing just the GUI with Python.


The interface for writing email will be quite similar to what is available today with most email clients, with some simplifications.
== Schedule ==


The interface for reading email will be different, since there are no folders.
=== Before SOC ===


:A tag toolbar will be visible displaying all the tags (as mentioned above, a custom widget for tags will be developed). Clicking on a tag will display the messages associated with that tag. Sorting on metadata is possible with the use of a similar interface to [http://wiki.laptop.org/images/8/81/Journal-03.jpeg].
I will be collaborating with my mentor and community on a good design.
: Clicking on a message in the list displays that message. The tag toolbar will still be visible, and dragging-and-dropping a tag onto the message will apply it. Simply clicking on a tag will lead back to the list of messages for that tag.


=== Other features ===
I would like to be able to dive into coding when the SOC period begins, so in the interim period I will further familiarize myself with pygtk/GTK+, sqlite and the Sugar activity API.


An asterisk indicates a feature that will probably not be implemented in the summer and will serve as future direction.
* experiment with email storage in a database so I can have a database schema to start work with
* work on a grammar for searches and experiment with fts-indexing
* have sending/receiving code ready
* have a prototype activity that I can build upon ready


'''Contacts''' *
=== Milestones ===


A simple address book should be implemented for address auto-completion. This can later be extended and made more featuresome, or share data with a (potential) contacts activity.
* May 29: I can officially start coding


Address auto-completion will be performed based on the contacts in the address book. Stub entries for contacts can be automatically added based on email sent directly to the user (and not mass email like mailing lists), and recipients of sent email.
* July 1: Sending/receiving/storage/tagging works


'''HTML email''' *
* July 21: Search/filtering/smart tag will work. Some optimizations to the database schema would have been made.


Rendering HTML email is again facilitated by the Tinymail framework (libtinymailui-mozembed)
* August 1: Configuration will have been made easy with the use of service descriptors


With regard to composition, Martin Sevior suggests
* August 10: Contacts support (address auto-completion, management) will work
:You can immediately reuse the AbiWidget from libabiword for your rich text HTML editor. libabiword has a very capable export content to HTML feature. You can copy and paste the relevant parts from the Write program to have the same interface as Write if you wish.


Email composition will default to plain text.
* August 17: Daemon will work


'''Message threading''' *
* August 18: Google's "pencil's down" date. The database schema and service descriptor file format is frozen. Work continues but not under the GSoC umbrella anymore :-)


[http://www.jwz.org/doc/threading.html jwz's threading algorithm] can be used. It was proposed in the imapext-thread Internet Draft. It should be possible for the user to manually thread by drag-and-drop where the algorithm gets it wrong. Thread associations can be cached for better performance.
(Tentative. Associated UI work is implied.)


'''Spam filtering'''
=== Beyond SOC ===


In this stage of development I think it would be best to 'outsource' the spam filtering. SpamAssassin headers can be supported with a default filter. Using POP/IMAP with Gmail, spam is already filtered out by Gmail.
I would of course like to continue working on this project beyond the SOC period on, initially primarily on:
* documenting
* testing
* optimizing for performance and making the activity more usable
* see below :-)


'''mailto: URI'''
== A vision for future direction ==


Support for mailto: links will be implemented, so that for example clicking on such a link in Browse opens the activity in the 'Write' tab.
<todo>


[[Category:GSoC proposals]]
[[Category:GSoC proposals]]

Latest revision as of 23:54, 12 May 2009

I welcome your comments and feedback on the Talk page.

I used to write on the status of the project on my worklog. It was dormant for a while and I have now resumed development, with the new repository being http://git.sugarlabs.org/projects/sweetmail Shikhar 20:40, 18 January 2009 (UTC)

Abandoned for now 212.201.44.249 23:54, 12 May 2009 (UTC)

Abstract

Currently the XO ships with a Gmail activity that launches Browse in Gmail. Disconnected operation has however not been addressed.

Collaboration tools are a very important part of the OLPC software bundle and an activity which brings email to the XO desktop and ties in with the environment would be a very useful addition. An email client with mesh integration like direct sending to mesh buddies and other fancy features would be great, but the basic groundwork of a usable email activity is needed.

This project will aim at the development of an email activity which is functional and usable for children, and provides the necessary features. Furthermore a daemon which facilitates background tasks like sending/receiving when internet access is available will be developed.

Background

  • Dead Email project and related discussion Talk:Email
  • Draft specification from a former OLPC intern, also looking at how different email clients implement functionality. [1]
I mostly agree with the specs, and I have incorporated ideas which would be implementable in the summer.
  • The Tinymail framework has a demo, proof-of-concept email client for OLPC.

Use cases

In general the use cases of an email client for OLPC users should be quite clear :-)

  • collaborating on projects
  • sending/receiving attachments
  • pen pals
  • participating in discussions on mailing lists

Deliverables

Broadly,

  • A lightweight, functional email client with a child-friendly GUI
  • A daemon for sending of unsent messages and receiving of new email. [The rationale behind this is we can't assume the child will open the email activity when internet access is available.]

Other requisites:

  • POP, SMTP, and IMAP support, and also with Transport Layer Security
  • Should support ASCII and MIME-encoded Unicode. Sane selection during composition.
  • Easy configuration on first run and later
  • Search should be central and helpful
  • Should have at least a basic address book
  • Should be able to handle large volumes of email and generally perform well

Design principles

  • Disconnected operation
  • Lean and mean
  • Ease of use: functionality without complicating
  • Should lay groundwork for future development, and towards that - sane decisions, sane code, sane UI

Ideas

Tinymail

The Tinymail framework provides a very flexible API for the creation of an email client, and is ideally suited for the XO.

Email organization

I would like to center email organization around tags and not folders. The idea behind using tags and not folders is well-articulated here

The Journal already uses tags, and for this activity I would like to extend them to have a visual representation as a GTK widget. They should be easily managed visually, for example dragging-and-dropping a tag onto a message should apply it.

Email sending/receiving, MIME handling

libtinymail-camel is an adaptation of the camel library which is developed by the Evolution team and as such offers tried-and-tested support for POP, SMTP, IMAP and TLS, as well as MIME handling.

Storage

Tinymail offers maildir support, and the idea is to use a single maildir folder for all messages, and store tag-UID associations in a sqlite database. Headers will also be cached in the database, since this will be a common query. Towards this a good database schema that takes performance into consideration will be used.

An abstraction layer for storage-related requests that cleanly combines Tinymail's methods with the database will be developed.

Service descriptors

To make it easy and extensible to configure on first run for services such as Gmail, a file format for 'service descriptors' can be formalized.

The service descriptor would contain details about servers, protocols, junk-headers provided by the service, etc. Thus the only information required upon selection of a service should be username and password.

It should be possible to specify certain details in the service descriptor such as whether the service sets SpamAssassin headers, which IMAP folders are not to be downloaded. For example the Gmail service descriptor could specify that email in the 'All Mail', 'Spam' and 'Trash' folder is not to be downloaded, and that other folder names are to be interpreted as tags, since Gmail provides IMAP.

Search back-end

Having a flexible, efficient, and robust search back end would have many benefits for this activity.

I propose formalizing a common grammar for searches, filtering criteria and smart tag criteria. For example, to be able to search for received:today, and also as easily create a smart tag called "today's email" using that string, or create a filter that applies tag "papa" to all emails I receive with from:dad@smthn.org.

The UI for the tasks of searching, filter creation and smart tag creation (which should be as intuitive as possible), can then construct these strings. Ultimately I expect kids will pick up our simple domain specific language and prefer to enter the criteria directly than take to graphical mechanisms for specifying these strings.

Search

Some use cases would be perhaps more descriptive of how I would like to implement search:

  • I want to search all my email for the word "brinjal". I could just type in the keyword directly, erasing the tag:<name> qualifier for the currently selected tag, and type in "brinjal", and I would get results based on full text search of all email. Or I could have selected the smart tag "all email", and then appended to the search bar my keyword.
  • I select the tag lkml. The search bar now shows tag:lkml and messages for that tag are displayed. I want to filter the display to emails only from a Linus Torvalds. So I append to the search bar and make it tag:lkml from:linus and search. I could also have clicked on a drop down button and selected 'From' and proceeded to type in linus to achieve the same.

The default action on an empty search bar and typing in some keywords should be full text search of all email. In case a tag qualifier is present, only emails from that tag are searched. Searching on the basis of headers would not present much problem, and this can even be easily indexed using the sqlite fts module. Full text search would likely have to be performed on demand as indexing all email would be expensive in terms of flash space.

Filters

Filters are rules that are applied post-retrieval to email. It should be easy to specify filters in the user interface. The UI can transform the user's criteria and action to be applied into an extension of the search grammar. For matching against the criteria the search back-end can be used and the action applied on retrieval if the message matches.

header:"X-MailScanner-SpamCheck".starts:"sssss" | tag:spam untag:inbox | name:"spam assassin headers"
An example of how a filtering rule for SpamAssassin headers may be stored

Here the format is criteria | actions | metadata. Supported actions can be: tag, untag, erase, forward.

Smart tags

Smart tags as first class tags, except they can't be applied to messages since they are dynamically evaluated for the query they represent, and in that sense are like a saved search. It can be made possible to 'keep' a search as a smart tag. Smart tags should not be very hard to implement provided the search back-end is developed as planned.

received:today status:unread | "today's unread email"
An example of how a smart tag may be stored by the activity

User Interface

I am happy have to have the volunteer help of a student of Information and Digital Design with SVG icons and usability suggestions.

The activity will have an intuitive and discoverable user interface in light of children.

Currently as I visualize what I want to develop; I foresee four main tabs: for writing email, for reading email, for managing contacts, and for configuration. So:

[Write] [Read] [Contacts] [Configure]

Associated icons for these tabs will be displayed in the icon toolbar.

The interface for writing email will be quite similar to what is available today with most email clients, with some simplifications.

The interface for reading email will be different, since there are no folders.

A tag toolbar will be visible displaying all the tags (as mentioned above, a custom widget for tags will be developed). Clicking on a tag will display the messages associated with that tag. Sorting on metadata is possible with the use of a similar interface to [2].
Clicking on a message in the list displays that message. The tag toolbar will still be visible, and dragging-and-dropping a tag onto the message will apply it. Simply clicking on a tag will lead back to the list of messages for that tag.

Other features

An asterisk indicates a feature that will probably not be implemented in the summer and will serve as future direction.

Contacts *

A simple address book should be implemented for address auto-completion. This can later be extended and made more featuresome, or share data with a (potential) contacts activity.

Address auto-completion will be performed based on the contacts in the address book. Stub entries for contacts can be automatically added based on email sent directly to the user (and not mass email like mailing lists), and recipients of sent email.

HTML email *

Rendering HTML email is again facilitated by the Tinymail framework (libtinymailui-mozembed)

With regard to composition, Martin Sevior suggests

You can immediately reuse the AbiWidget from libabiword for your rich text HTML editor. libabiword has a very capable export content to HTML feature. You can copy and paste the relevant parts from the Write program to have the same interface as Write if you wish.

Email composition will default to plain text.

Message threading *

jwz's threading algorithm can be used. It was proposed in the imapext-thread Internet Draft. It should be possible for the user to manually thread by drag-and-drop where the algorithm gets it wrong. Thread associations can be cached for better performance.

Spam filtering

In this stage of development I think it would be best to 'outsource' the spam filtering. SpamAssassin headers can be supported with a default filter. Using POP/IMAP with Gmail, spam is already filtered out by Gmail.

mailto: URI

Support for mailto: links will be implemented, so that for example clicking on such a link in Browse opens the activity in the 'Write' tab.