Editing Improving Modest email sync reliability
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
- | Lots of complains have been reported regarding Modest | + | Lots of complains have been reported regarding Modest N900 email client. Particularly when it comes to sync emails. Quoting [http://talk.maemo.org/showthread.php?t=37225 link title DaveQB]: |
# It takes about 20mins to check my email. | # It takes about 20mins to check my email. | ||
Line 6: | Line 6: | ||
# You can't do any searching. | # You can't do any searching. | ||
# It doesn't respect subscribed folder settings on the server | # It doesn't respect subscribed folder settings on the server | ||
- | |||
I basically faced all these problems, but synchronization is the top most important one for me. This page is about trying to improve Modest email sync reliability and exploring other ways to read/write emails on N900. It mainly focuses on dealing with IMAP from a GMail account, but may be extended to other IMAP, and even other protocols such as POP. | I basically faced all these problems, but synchronization is the top most important one for me. This page is about trying to improve Modest email sync reliability and exploring other ways to read/write emails on N900. It mainly focuses on dealing with IMAP from a GMail account, but may be extended to other IMAP, and even other protocols such as POP. | ||
Line 31: | Line 30: | ||
* ssl: because this IMAP account is an IMAPS account (using SSL encryption) | * ssl: because this IMAP account is an IMAPS account (using SSL encryption) | ||
- | This deb file can be found, | + | This deb file can be found, attached to this page. |
- | First, copy mutt deb file to your N900 (scp, mail, etc...) and install it | + | First, copy mutt deb file to your N900 (scp, mail, etc...) and install it as root: |
- | sudo | + | sudo fakeroot |
dpkg -i mutt_1.5.20-2_armel.deb | dpkg -i mutt_1.5.20-2_armel.deb | ||
You then need to write your .muttrc file to setup your IMAP account connection. Here's my basic muttrc file I used to access my Gmail account: | You then need to write your .muttrc file to setup your IMAP account connection. Here's my basic muttrc file I used to access my Gmail account: | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | # IMAP | + | # General |
- | set imap_authenticators="login" | + | set move=no |
- | set imap_passive="no" | + | set quit=ask-yes |
- | set imap_user = 'username' | + | set timeout=15 |
- | set imap_pass = 'password' | + | auto_view text/html |
- | set spoolfile = imaps://imap.gmail.com:993/INBOX | + | set realname="Sebastien Lelong" |
- | set folder = imaps://imap.gmail.com:993 | + | |
- | set record="imaps://imap.gmail.com/[Gmail]/Sent Mail" | + | # IMAP |
- | set maildir_trash = yes | + | set imap_authenticators="login" |
- | set postponed="imaps://imap.gmail.com/[Gmail]/Drafts" | + | set imap_passive="no" |
- | set header_cache = yes | + | set imap_user = 'username' |
- | set smtp_url = smtp://username@gmail.com@smtp.gmail.com:587/ | + | set imap_pass = 'password' |
- | set smtp_pass = "password" | + | set spoolfile = imaps://imap.gmail.com:993/INBOX |
- | + | set folder = imaps://imap.gmail.com:993 | |
+ | set record="imaps://imap.gmail.com/[Gmail]/Sent Mail" | ||
+ | set maildir_trash = yes | ||
+ | set postponed="imaps://imap.gmail.com/[Gmail]/Drafts" | ||
+ | set header_cache = yes | ||
+ | set smtp_url = smtp://username@gmail.com@smtp.gmail.com:587/ | ||
+ | set smtp_pass = "password" | ||
+ | |||
Replace username and password as needed. Launch mutt: | Replace username and password as needed. Launch mutt: | ||
Line 73: | Line 72: | ||
== offlineimap to read emails when no network connection is available == | == offlineimap to read emails when no network connection is available == | ||
- | While one major advantage to IMAP protocol is being able to directly and remotely access emails on an account, when you don't have any network connection, you just can | + | While one major advantage to IMAP protocol is to being able to directly and remotely access emails on an account, when you don't have any network connection, you just can access them... A workaround is to use a tool like [http://wiki.github.com/jgoerzen/offlineimap/ OfflineIMAP], which can synchronize an IMAP account with a local maildir. |
This sync occurs both ways: changes on IMAP account will propagate to maildir, changes on maildir will propagate to IMAP account. This ensure what you'll locally read will also be marked as read on the IMAP server. | This sync occurs both ways: changes on IMAP account will propagate to maildir, changes on maildir will propagate to IMAP account. This ensure what you'll locally read will also be marked as read on the IMAP server. | ||
- | In order to use offlineimap, I had to get last sources including patches to select only emails not olders than X days. This will prevent getting *all* emails from the server (headers and bodies)... | + | In order to use offlineimap, I had to get last sources including patches to select only emails not olders than X days. This will prevent getting *all* emails from the server (headers and bodies)... You'll find attached to this page a very quick & dirty deb package for offlineimap. Install it as root: |
- | sudo | + | sudo fakeroot |
- | + | dpkg -i offlineimap_6.2.1_all.deb | |
exit | exit | ||
- | Once installed, you'll need to create | + | Once installed, you'll need to create ~/.offlineimaprc in order to define remote IMAP and local maildir accounts. Here's mine, again minimalist. See offlineimap.conf on OfflineIMAP website to figure out possible options. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | [ | + | [general] |
- | + | accounts = GMail | |
- | + | ui = Noninteractive.Basic | |
- | + | ||
- | [Repository Local] | + | [Account GMail] |
- | type = Maildir | + | localrepository = Local |
- | localfolders = ~/Mail/GMail | + | remoterepository = Remote |
- | + | maxage = 5 | |
- | + | ||
- | [Repository Remote] | + | [Repository Local] |
- | type = Gmail | + | type = Maildir |
- | remoteuser = username | + | localfolders = ~/Mail/GMail |
- | remotepass = password | + | |
- | realdelete = no | + | [Repository Remote] |
- | trashfolder = [Gmail].Trash | + | type = Gmail |
- | + | remoteuser = username | |
- | + | remotepass = password | |
- | + | realdelete = no | |
- | We | + | trashfolder = [Gmail].Trash |
+ | |||
+ | |||
+ | We basically telling offlineimap to sync a GMail IMAP account on a local maildir located in ~/Mail/GMail. Only emails younger than 5 days will be considered. All IMAP directories will be synced (no filter). | ||
Also create maildir location: | Also create maildir location: | ||
Line 116: | Line 112: | ||
Finally, because my deb packaging isn't that good, let's create a wrapper bash script to run offlineimap: | Finally, because my deb packaging isn't that good, let's create a wrapper bash script to run offlineimap: | ||
- | + | ||
- | #!/bin/bash | + | #!/bin/bash |
- | offlineimap 2>&1 | tee /tmp/offlineimap.log | + | PYTHONPATH=/scratchbox/tools/lib/python2.3/site-packages /scratchbox/tools/bin/offlineimap 2>&1 | tee /tmp/offlineimap.log |
- | echo Last run: `/bin/date` | + | echo Last run: `/bin/date` |
- | + | ||
- | Save this script in | + | Save this script in ~/bin (for instance) as "syncemail.sh", and make executable: |
chmod +x syncemail.sh | chmod +x syncemail.sh | ||
- | Each time it's launched, you can check what it does looking as | + | Each time it's launched, you can check what it does looking as /tmp/offlineimap.log. |
Time to test. Run it ! | Time to test. Run it ! | ||
Line 135: | Line 131: | ||
mutt -f ~/Mail/GMail/INBOX | mutt -f ~/Mail/GMail/INBOX | ||
- | If it sounds good to you, you can program a task, for instance using Alarmed, and configure it to run this script every X minutes | + | If it sounds good to you, you can program a task, for instance using Alarmed, and configure it to run this script every X minutes. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
So far so good, we have our emails synced. We can read them using mutt. Still, we may like to use a graphical front-end, fully integrated to N900 system (applet, widgets, contacts, etc...). | So far so good, we have our emails synced. We can read them using mutt. Still, we may like to use a graphical front-end, fully integrated to N900 system (applet, widgets, contacts, etc...). | ||
Line 160: | Line 139: | ||
If only Modest could directly access our local maildir... Since it only support POP and IMAP account, we could install a local IMAP server, serving our maildir. Modest would then access this local IMAP server. This way, the remote sync part is delegated to offlineimap, while we can still use GUI front-ends. You'll still need to tell Modest to sync to the local maildir to check new emails. A short interval, 5 min, will ensure it'll be able to sync (since it's local, there's no network related issue anymore). | If only Modest could directly access our local maildir... Since it only support POP and IMAP account, we could install a local IMAP server, serving our maildir. Modest would then access this local IMAP server. This way, the remote sync part is delegated to offlineimap, while we can still use GUI front-ends. You'll still need to tell Modest to sync to the local maildir to check new emails. A short interval, 5 min, will ensure it'll be able to sync (since it's local, there's no network related issue anymore). | ||
- | So, there are many IMAP server out there, I found dovecot to be easy to package and use. | + | So, there are many IMAP server out there, I found dovecot to be easy to package and use. You'll find deb file attached to this page. Install it as root |
sudo gainroot | sudo gainroot | ||
- | + | dpkg -i dovecot_1.2.11-1_armel.deb | |
exit | exit | ||
Line 171: | Line 150: | ||
cp /usr/local/etc/dovecot-example.conf /usr/local/etc/dovecot.conf | cp /usr/local/etc/dovecot-example.conf /usr/local/etc/dovecot.conf | ||
- | Dovecot is very powerful, you can set a lot of parameters. I tried to keep it as simple as possible. Dovecot will | + | Dovecot is very powerful, you can set a lot of parameters. I tried to keep it as simple as possible. Dovecot will /etc/passwd as it's user/password database. Here's my dovecot.conf file: |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | base_dir = /var/run/dovecot/ | |
- | + | protocols = imap | |
- | + | disable_plaintext_auth = no | |
- | + | ssl = no | |
+ | login_user = dovecot | ||
+ | mail_location = maildir:~/Mail/GMail/INBOX | ||
- | + | protocol imap { | |
+ | } | ||
- | + | auth default { | |
- | + | ||
+ | mechanisms = plain | ||
+ | |||
+ | passdb passwd { | ||
+ | } | ||
+ | |||
+ | userdb passwd { | ||
+ | } | ||
- | + | user = root | |
- | + | } | |
- | |||
- | |||
- | |||
- | |||
- | You can check | + | You can check its syntax by running: |
dovecot -n | dovecot -n | ||
- | Dovecot auth will be done under user "dovecot". We need to create it: | + | Note dovecot will serve INBOX only (more work/search to be done in order to serve multiple maildirs...). Dovecot auth will be done under user "dovecot". We need to create it: |
sudo gainroot | sudo gainroot | ||
Line 212: | Line 189: | ||
sudo gainroot | sudo gainroot | ||
passwd user | passwd user | ||
+ | |||
Launch dovecot, as root | Launch dovecot, as root | ||
Line 226: | Line 204: | ||
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE AUTH=PLAIN] Dovecot ready. | * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE AUTH=PLAIN] Dovecot ready. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
Now open Modest, and add a new account: | Now open Modest, and add a new account: | ||
Line 244: | Line 215: | ||
About SMTP, you can use the one you're used to use. Another improvement would be to install a small local SMTP server, and let it send its emails when it can. So far SMTP sending works with Modest, so I didn't dig further. | About SMTP, you can use the one you're used to use. Another improvement would be to install a small local SMTP server, and let it send its emails when it can. So far SMTP sending works with Modest, so I didn't dig further. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- |
Learn more about Contributing to the wiki.