Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 09-10-2011, 08:30 PM   #1
the_vorpal_blade
Junior Member
the_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with others
 
Posts: 3
Karma: 2600
Join Date: Sep 2011
Device: kindle
mutt e-mail client on the kindle

Hey Folks,
I've been lurking for a bit, but this is my first post :-)

I recently got mutt working and configured on the kindle, and thought I'd share:

DISCLAIMER:
Running a mail client on the kindle means making the root filesystem writable by default. This is dangerous. If you fill up your root partition, you risk making your kindle unbootable!


Notes:
1. Wherever I put something in <brackets> I intend you to substitute your
own value. I most often use this for <username> and <password>
2. Although you could go through most of this guide without logging in to your kindle via usb networking or ssh over wifi, it is much easier if you do most of the below while logged in from your computer.
this link:
https://www.mobileread.com/forums/sho...85&postcount=8
has instructions for connecting via ssh over wifi and making the sshd start at boot. Authenticating via key rather than username and password, is, of course, not essential, but you should probably change the default root password using
Code:
passwd
first.


Step 1:
Jailbreak your kindle. I used:
http://yifan.lu/p/kindle-jailbreak

Step 2:
Install usbNetwork Hack and native kindle terminal. I used:
https://www.mobileread.com/forums/sho...d.php?t=125860
which links here:
http://info.iet.unipi.it/~luigi/kind...indle-terminal

Step 3:
Install optware. I used:
https://www.mobileread.com/forums/sho...d.php?t=118472
This script looks promising, but it failed for me on a hash check:
https://gist.github.com/791141

Step 4:
Set up your path. I changed relevant line in /etc/profile from:
Code:
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin
to:
Code:
export PATH=/opt/bin:/opt/sbin:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin
Step 5:
set up a user account
Code:
mkdir -p /home/<username>
adduser <username> (and follow the prompts)
chown <username> /home/<username>
chgrp <username>  /home/<username>
step 6:
use ipkg to install the appropriate mail utilities. vim and sudo are not strictly essential to this setup, but are helpful.
Code:
ipkg install mutt fetchmail procmail msmtp sudo vim
step 6.5:
if you installed sudo, add yourself to the sudoers file.
Code:
visudo
then change:
Code:
root ALL=(ALL) ALL
to:
Code:
root ALL=(ALL) ALL 
<username> ALL=(ALL) ALL
step 7:
fix the kindle's strange permissions
Since the kidnle was never really invisioned as a multi-user device, the
permissions on things like /dev/null and /dev/random are tighter than they really should be. So, fix that:
Code:
chmod a+rw /dev/null
chmod a+rw /dev/random
chmod a+rw /dev/urandom
you can either do this every time you reboot the kindle, or make it permanent, but putting it in an init script.
To put it in an init script, do something like:
Code:
vim /etc/init.d/fixperms
then put in:
Code:
#!/bin/sh
#a script for making the kindle more multi-user friendly
mntroot rw
chmod a+rw /dev/null
chmod a+rw /dev/random
chmod a+rw /dev/urandom
then to make it run at boot
Code:
chmod +x /etc/init.d/fixperms
ln -s /etc/init.d/fixperms /etc/rc.5/S99fixperms
Step 8:
Logging in
Code:
login
Then put in your username and password.

Step 9:
Configuring mutt
(Most of this came from http://www.andrews-corner.org/mutt.html )
Put the following in your ~/.muttrc file, in your home directory
Code:
# Colors Generated by the muttrc builder (http://muttrcbuilder.org/)
# for mutt-1.5.18

# Colors
# We set all the colors to black on while for maximum kindle readability
color attachment black        white
color error      black        white
color hdrdefault black        white
color indicator  black        white
color markers    black        white
color message    black        white
color normal     black        white
color quoted     black        white
color search     black        white
color signature  black        white
color status     black        white
color tilde      black        white
color tree       black        white

#The rest of the config taken from http://www.andrews-corner.org/mutt.html
#======================================================#
# Boring details
# I use Gmail, so this configuration caters to that.
set realname = "<Your Name>"
set from = "<gmail username>@gmail.com"
set use_from = yes
set envelope_from ="yes"

# Use a signature
set signature="~/.signature"

# Use msmtp rather than sendmail. Check that 
# the path is correct for your system:
set sendmail="/opt/bin/msmtp"

# If not set in ~/.bashrc:
set spoolfile = "/opt/var/spool/mail/<username>"

#======================================================#
# Folders
set folder="$HOME/mail"      # Local mailboxes stored here
set record="+sent"           # Where to store sent messages
set postponed="+postponed"   # Where to store draft messages
set mbox_type=mbox           # Mailbox type
set move=no                  # Don't move mail from spool

#======================================================#
# Watch these mailboxes for new mail, useful only if 
# Procmail or Maildrop is used to sort mail.
mailboxes ! +slrn +fetchmail +mutt
set sort_browser=alpha    # Sort mailboxes by alpha(bet)

#======================================================#
# What to show and order of headers
ignore *
unignore Date: From: User-Agent: X-Mailer X-Operating-System To: \
         Cc: Reply-To: Subject: Mail-Followup-To:
hdr_order Date: From: User-Agent: X-Mailer X-Operating-System To: \
         Cc: Reply-To: Subject: Mail-Followup-To:

#======================================================#
# which editor do you want to use? 
# vim of course!
set editor="vim -c 'set tw=70 et' '+/^$' "
set edit_headers=yes      # See the headers when editing

#======================================================#
# Aliases

set alias_file = ~/mail/mutt_aliases # In their own file
source ~/mail/mutt_aliases           # Source them
set sort_alias=alias                 # Sort alphabetically


#======================================================#
# Odds and ends

set markers          # mark wrapped lines of text in the pager with a +
set smart_wrap       # Don't wrap mid-word
set pager_context=5  # Retain 5 lines of previous page when scrolling.
set status_on_top    # Status bar on top.
push <show-version>  # Shows mutt version at startup
We also have to make the mail directory, so in your home directory
Code:
mkdir ~/mail
touch ~/mail/mutt_aliases
Step 10
Configuring fetchmail
Put the following in .fetchmailrc in your home directory
Code:
poll imap.gmail.com 
protocol IMAP 
user "<your gmail address>" 
there with password <your gmail password>"
nofetchall
mda "/opt/bin/procmail -d %T"        
ssl
sslcertck
sslcertfile /etc/ssl/certs/ca-certificates.crt
keep
Since your password is in the file, we may as well chmod it
Code:
chmod 600 .fetchmailrc
Step 11:
Configuring procmail
Put the following in ~/.procmailrc
Code:
PATH=/opt/sbin:/opt/bin:/bin:/usr/bin:/usr/local/bin
VERBOSE=off
DEFAULT=/opt/var/spool/mail/matthew
MAILDIR=$HOME/mail
LOGFILE=$HOME/.procmaillog
# Recipes below this comment:
Now we need to make the spool file.
Code:
sudo mkdir -p /opt/var/spool/mail/
sudo chmod a+rw /opt/var/spool/mail/
step 12:
Configuring msmtp
Put the follwoing in ~/.msmtprc

Code:
account default              
host smtp.gmail.com          
port 587                     
from <gmail address>     
tls on                       
tls_starttls on              
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth on                     
user <gmail username>      
password <gmail password>     
logfile ~/.msmtp.log
At this point everything should work.
To check for new messages, run fetchmail, to read them, run mutt.
you can even run fetchmail from within mutt with
Code:
!fetchmail
Bugs/things I with were better about my setup::
Ideally, I'd like to put the spool folder on /mnt/us/ somewhere,
so that there is no chance of it filling up the root filesystem. However,
I can't seem to make /mnt/us/ writable to an ordinary user.

My script for fixing permissions on boot time only seems to work sometimes. I don't know why.

When logging in via ssh, I can only log in as user: root, then I can run login to get to my user. I don't know why.

When starting the standalone kindle terminal, /etc/profile is not read, and login is not called. Ideally, when that terminal started, it would call login, but I don't know how to make it do that either.

Any suggestions for improvements are welcome :-)

-Matthew
the_vorpal_blade is offline   Reply With Quote
Old 10-05-2011, 05:18 AM   #2
anthonyb
Member
anthonyb began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Sep 2011
Device: Kindle 3 WiFi v3.2.1
Hi Matthew

I'm looking forward to trying out your procedure to get Mutt up and running! I don't like the idea though of having the root FS remain writable (and possibly filling it up). Would it not be safer to use /mnt/us even if this means having to login as root? Why do you want to login as an ordinary user?

If you can't make /mnt/us writable for an ordinary user, I'm wondering about the suggestion in the post on installing optware to create an ext2 file in /mnt/us and then mounting that for opt. I wonder if this FS could then be made writable for an ordinary user and be used for the spool folder?
anthonyb is offline   Reply With Quote
Old 10-05-2011, 07:43 AM   #3
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Using a loop-mounted filesystem in /mnt/us would clearly be a better solution and even allow for using user accounts other than root. I would not suggest to keep the rootfs writable, and I would not suggest to mess with the rootfs more than absolutely necessary.
hawhill is offline   Reply With Quote
Old 10-06-2011, 02:15 AM   #4
the_vorpal_blade
Junior Member
the_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with others
 
Posts: 3
Karma: 2600
Join Date: Sep 2011
Device: kindle
Great idea hawhill and anthonyb
I'm thinking making /opt and /home mountpoints for loop filesystems in /mnt/us would solve my problem of needing to leave the root fs mounted rw, a situation I agree it would be preferable to avoid. I'll update my howto post as soon as I've tested it.

-Matthew
the_vorpal_blade is offline   Reply With Quote
Old 10-07-2011, 01:57 PM   #5
anthonyb
Member
anthonyb began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Sep 2011
Device: Kindle 3 WiFi v3.2.1
After creating a loop mounted ext3 file system as /mnt/loc (see thread on optware) I had to:
mkdir /mnt/loc/home
mkdir -p /mnt/loc/opt/var/spool/mail
mntroot rw
ln -s /mnt/loc/home /home
ln -s /mnt/loc/opt/var/spool /opt/var/spool
ln -s /mnt/loc/opt/doc /opt/doc
ln -s /mnt/loc/opt/libexec /opt/libexec
ln -s /mnt/loc/opt/include /opt/include
mntroot ro
anthonyb is offline   Reply With Quote
Old 10-11-2011, 05:34 AM   #6
anthonyb
Member
anthonyb began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Sep 2011
Device: Kindle 3 WiFi v3.2.1
I also noticed that changes to /etc/profile have no effect when starting a new terminal with kiterm (although some of the original settings in it do seem to have been applied?). The latest build I have of myts (kiterm) sets ENV=/mnt/us/kiterm/profile and this profile script is called successfully for root. When I then logon as myself it is not called - for my own user the script in /home/<myuser>/.profile is called.

I also tried fetchmail with a POP3 server. It tries to use service "pop3" but in /etc/services this is defined as "pop-3" so one has to add an alias for pop3 or add the line "service pop-3" to .fetchmailrc
anthonyb is offline   Reply With Quote
Old 10-18-2011, 08:24 AM   #7
anthonyb
Member
anthonyb began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Sep 2011
Device: Kindle 3 WiFi v3.2.1
Now that mutt is working I realise much of my email is in HTML format. So I'm thinking the next step it to create a .mailcap file to handle text/html; via w3m (or links) and adding auto_view text/html to .muttrc. I wonder if w3m or links is available on optware? Or better yet (perhaps), is there some way to launch the html via the browser built into the Kindle?
anthonyb is offline   Reply With Quote
Old 10-21-2011, 12:43 AM   #8
the_vorpal_blade
Junior Member
the_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with othersthe_vorpal_blade plays well with others
 
Posts: 3
Karma: 2600
Join Date: Sep 2011
Device: kindle
w3m is indeed available in optware, as is elinks, links2, some busybox version of links and lynx :-)

Be careful with your conf files so that your browser of choice renders everything as black text on white background though :-)
the_vorpal_blade is offline   Reply With Quote
Old 10-22-2011, 01:46 PM   #9
anthonyb
Member
anthonyb began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Sep 2011
Device: Kindle 3 WiFi v3.2.1
Well I decided to go for w3m. When I ran it I got "can't find termcap entry linux" so I had to install termcap too which fixed it. Trying it with -M option to set monochrome, but maybe I'll have to fiddle with color settings too. Speaking of which, I can't see which is the active message in mutt using the color settings above.
anthonyb is offline   Reply With Quote
Old 12-06-2011, 11:21 PM   #10
kociubin
Junior Member
kociubin began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2011
Device: kindle 3g
Quote:
Originally Posted by anthonyb View Post
Well I decided to go for w3m. When I ran it I got "can't find termcap entry linux" so I had to install termcap too which fixed it. Trying it with -M option to set monochrome, but maybe I'll have to fiddle with color settings too. Speaking of which, I can't see which is the active message in mutt using the color settings above.
Add this to your .muttrc file. It will give you a nice "->" cursor that replaces the highlight bar for selecting the email to view in the list.

Code:
set arrow_cursor
kociubin is offline   Reply With Quote
Old 12-06-2011, 11:37 PM   #11
kociubin
Junior Member
kociubin began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2011
Device: kindle 3g
Thanks OP! This is a good idea and mutt can be quite functional as a mail client. BTW, I just set my root user's home directory to '/mnt/us/root' and run mutt as root.

Also, for those who want a richer IMAP/Gmail experience (e.g. being able to move emails to folders, delete, archive, etc), you can take advantage of the built in IMAP support. No fetchmail necessary.

here is my .muttrc configuration.

Code:
set imap_user = "your_username@gmail.com"
set imap_pass = "your_password"

set folder = "imaps://imap.gmail.com"
set spoolfile = "+INBOX"

set realname = "Firstname Lastname"
set from = "your_username@gmail.com"
set use_from = yes

set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set record = "+[GMail]/Sent Mail"
set move = no
set include
set sort = 'threads'
#set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
auto_view text/html

#======================================================#
# What to show and order of headers
ignore *
unignore Date: From: User-Agent: X-Mailer X-Operating-System To: \
         Cc: Reply-To: Subject: Mail-Followup-To:
        hdr_order Date: From: User-Agent: X-Mailer X-Operating-System To: \
        Cc: Reply-To: Subject: Mail-Followup-To:

set smart_wrap       # Don't wrap mid-word
set pager_context=5  # Retain 5 lines of previous page when scrolling.

# Colors
# We set all the colors to black on while for maximum kindle readability
set arrow_cursor
color attachment black        white
color error      black        white
color hdrdefault black        white
color indicator  black        white
color markers    black        white
color message    black        white
color normal     black        white
color quoted     black        white
color search     black        white
color signature  black        white
color status     black        white
color tilde      black        white
color tree       black        white
Works great! The added benefit is that you don't need fetchmail and procmail (you do need msmtprc though).
kociubin is offline   Reply With Quote
Old 12-09-2011, 01:42 AM   #12
anthonyb
Member
anthonyb began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Sep 2011
Device: Kindle 3 WiFi v3.2.1
Thanks for the tip!

(I had changed the colors to get a grey selection bar, but with the way the eink is updated, each time I move the selection up and down the text becomes lighter and lighter!)
anthonyb is offline   Reply With Quote
Old 07-07-2012, 03:34 PM   #13
ed007
Member
ed007 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2011
Device: pocketbook 603a
1. Works with firmware 3.3?
2. Supports file attachments? (pdf, zip ...)
3. Maybe someone wrote a script for easy installation of the client?
ed007 is offline   Reply With Quote
Old 07-09-2012, 09:38 AM   #14
hfpop
Addict
hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.
 
Posts: 250
Karma: 136662
Join Date: Apr 2011
Device: N/A
Quote:
Originally Posted by kociubin View Post
Also, for those who want a richer IMAP/Gmail experience (e.g. being able to move emails to folders, delete, archive, etc), you can take advantage of the built in IMAP support. No fetchmail necessary.

here is my .muttrc configuration.
[/CODE]

Works great! The added benefit is that you don't need fetchmail and procmail (you do need msmtprc though).
I finally got it to connect with gmail for domains. I cannot send mail, I cannot see any gmail labels and I cannot see the contents of any standard label. Does this actually work? How?

Last edited by hfpop; 07-09-2012 at 11:04 AM.
hfpop is offline   Reply With Quote
Old 07-13-2012, 02:21 PM   #15
kociubin
Junior Member
kociubin began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2011
Device: kindle 3g
Quote:
Originally Posted by hfpop View Post
I finally got it to connect with gmail for domains. I cannot send mail, I cannot see any gmail labels and I cannot see the contents of any standard label. Does this actually work? How?
Yup. It works. For example, press "s" while you have an email selected in the list. It will allow you to move it to a label (press "?" after pressing "s" for a list of folders).


Similarily, you can press "c?" to switch to another folder.

To send email, you have to have msmtp installed and configured.
kociubin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hacks Is there an ssh client for the Kindle ? ninsei Amazon Kindle 3 11-18-2011 08:55 PM
Is there a native twitter client for Kindle? firstfan Kindle Developer's Corner 4 10-31-2010 08:40 PM
e-Mail on Kindle DX Alnilam Amazon Kindle 8 07-21-2009 12:23 PM
$20 Mail-in rebate for kindle atl475 Amazon Kindle 4 05-01-2008 02:10 PM
E-Mail Signatures in Mac Mail? Pride Of Lions Lounge 0 03-05-2004 08:47 PM


All times are GMT -4. The time now is 01:34 AM.


MobileRead.com is a privately owned, operated and funded community.