go-yo icon indicating copy to clipboard operation
go-yo copied to clipboard

A yo-yo for email, written in Go

go-yo

Go-Yo is like a yo-yo for email. The goal is to be self-hosted, giving the user full control over the deployment, and avoiding potential privacy or security issues with third-party services.

Bouncing Workflow

You will need to create a dedicated email address for bouncing Go-Yo email. For the purposes of this workflow, we will assume that your Go-Yo email address is [email protected]

(Almost) any email address will do, as long as you can receive mail there, and as long as your email provider allows you to create variants of your email address, like [email protected]. (Google/Gmail follows this convention - if you use another mail provider, please verify this).

In an email client such as mutt, simply bounce (or forward) an email to [email protected] in order to have that thread bumped back to the top of your inbox in 3 hours. You can also do things like [email protected], and [email protected].

For the time being, Go-Yo will be very conservative with how it parses this email address. This is a good thing; you don't want Go-Yo to think you want a reminder in six months when you really meant six minutes. If there are any problems with parsing the bounce interval, Go-Yo will send an error message (via email) immediately, so you can deal with it right away. No surprises.

Scheduling Workflow

Go-Yo can also be used to schedule messages. The exact workflow for this is TBD.

Under the hood

Go-Yo uses the Maildir format for interoperability. Documentation about the Maildir format is available at http://cr.yp.to/proto/maildir.html

Use a service such as offlineimap to fetch new messages and write them to the Maildir. Once new emails appear in the /new subdirectory, they are ready for processing by Go-Yo.

Go-Yo finds new messages in /new and, after processing them and scheduling the 'bounce' message, moves them to the /cur directory, adding the info string to the filename (see documentation) - and, specifically, setting the message flag to S (seen).

Go-Yo uses the unique portion of the filename to identify which messages to bounce.

After delivery, Go-Yo does not delete (ie, set flag T - trashed) for messages. This allows easy debugging and poor-man's logging.

Setup

(This setup procedure is subject to change until the first stable release of go-yo. Until then, go-yo must be compiled from source and run manually).

ec2-run-instances ami-d0f89fb9 -k KEYPAIR_NAME 

SSH into the instance once it's up and running.

First, we'll need to install Go

wget https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.1.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

Set your GOPATH

echo "export GOPATH=~/go" >> ~/.bashrc && source .bashrc

Install offlineimap and git if they are not already installed.

sudo apt-get install offlineimap git

Then, populate ~/.offlineimaprc with the following (create it if it does not exist).

[general]
ui = ttyui
accounts = GMail

[Account GMail]
localrepository = Gmail-Local
remoterepository = Gmail-Remote
#Controls how many accounts may be synchronized simultaneously
maxsyncaccounts = 3 
maxconnections = 3 

[Repository Gmail-Local]
type = Maildir
localfolders = ~/mail/GMail

[Repository Gmail-Remote]
type = Gmail
remoteuser = [email protected]
remotepass = YOUR_PASSWORD_HERE
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
realdelete = no
# Instead of closing the connection once a sync is complete, offlineimap will
# send empty data to the server to hold the connection open. A value of 60
# attempts to hold the connection for a minute between syncs (both quick and 
# autorefresh)
keepalive = 60
mkdir -p ~/mail/GMail

Test it out now

offlineimap -o

If you get no error messages, synchronization worked, and you should now have a complete folder mail within ~/mail/GMail

Now, time to install go-yo

go get github.com/ChimeraCoder/go-yo

Start running go-yo

$GOPATH/bin/go-yo -rootdir ~/mail/GMail/INBOX/ -email YOUR_EMAIL_ADDRESS -password EMAIL_PASSWORD -configuredemail CONFIGUREDEMAIL

Eventually you will want to run offlineimap in the background