Sending messages from the outer space

email on Plan 9

Basic Setup

Storing password

Store your account’s password to factotum. You can follow my guide about secstore. For now, we can use an encrypted file that will feed factotum. Spin up a temporary directory and add your passwords in a file.

% ramfs -p
% cd /tmp
% echo 'key proto=pass service=imap user=youruser !password=yourpassword' >> tmp.pass
% echo 'key proto=pass service=smtp user=youruser !password=yourpassword' >> tmp.pass
N.B. You can add as many lines as you want. You may want to type them directly in tmp.pass to not echo your password to the text window.

Encrypt the file and move it elsewhere because /tmp will be wiped when this window will be closed. Then, decrypt the file as a test.

% auth/aescbc -e < tmp.pass > pass
aescbc key:
% mv pass $home/lib/pass
% auth/aescbc -d < pass
N.B. The password won’t be echoed.

If it prints your password, you can add the following command to $home/lib/profile. This will decrypt your passwords and transfer them to factotum. factotum do not persistently keep secrets in memory. Adding the following command to your profile will feed factotum with your passwords when your session begins.

auth/aescbc -d < $home/lib/pass | read -m > /mnt/factotum/ctl

Opening One Inbox

It’s the most painless way to check your emails and get notified by faces.

% upas/fs -f /imaps/

The first fetching run will get you the following error:

echo: write error: for not recognized: sha256=wKRs7Hc9uafHhMdfSEARYHIAKiUApUfa8u5Aq6/UwTk

Import the certificate hash to fix this error.

% echo 'x509 sha256=wKRs7Hc9uafHhMdfSEARYHIAKiUApUfa8u5Aq6/UwTk' >> /sys/lib/tls/mail

Now, you can open your inbox.

% upas/fs -f /imaps/
% faces -i

Add the first line to your profile to have your inbox loaded during your next startup. You can also check another mailbox for the current window’s lifespan.

% upas/fs -f /imaps/
N.B This mailbox will replace /mail/fs/mbox for the current window only.

Opening multiple maiboxes

Add mailboxes to the mail file server.

% echo 'open /imaps/ maildir' > /mail/fs/ctl
% echo 'open /imaps/ maildir2' > /mail/fs/ctl
N.B. Large mailboxes will be slow to fetch

Replace “maildir” with one of your account’s folder or “label”, such as “Inbox”. You have to open your mailboxes every time you launch a new filesystem, so add these commands to your profile or in a script for convenience.

Notification with faces

Use faces(1) to read your mailboxes. The following command will look for new emails only. Emails are displayed with a right click and individual faces can be discarded with a left click.

% faces -c -m /mail/fs/maildir -m /mail/fs/maildir2
The famous faces program (customized).
fig. The famous faces program (customized).

Reading email

The mail command will take care of opening mailboxes and sending emails. acme also have its own mail client and you can read its man page at acmemail(1).


nedmail is invoked by mail without arguments or by upas/nedmail. It will assume that your mailbox is located in /mail/fs/mbox. To read another mailbox run the following:

upas/nedmail -f Sent
: !# Switch to another mailbox
: mb Archive

A clone of nedmail, mother was created by sl. It also comes with a script to open messages plumbed from faces.


Nail is the new acme mail client by orib that replace the previous Mail. It was since merged into 9front and Nail was renamed Mail. Old documentation about Mail may not apply to the new Mail.

Just like upas/nedmail, middle-clicking Mail in acme will launch it assuming that your mailbox is in /mail/fs/mbox. To open another mailbox, execute one of the following:

Mail Inbox
Mail Sent
Mail Whatever

To make things easier, create dump of your acme session with your mailbox oppened. You may also want to create an acme window dedicated to email. ptrap(4) can prevent acme to get plumbed anything but email. I created two scripts for this setup.

window 400,0,1920,1080 acmenail
fig. Content of $home/bin/rc/nailstart
ptrap edit '.*' +action '^shodata' +filename '^/mail/'
acme -f /lib/font/bit/outputm/unicode.14.font -F /lib/font/bit/mdio/unicode.14.font -l $home/lib/acme.dump
fig. Content of $home/bin/rc/acmenail

Sending email

First thing first, you have to copy /mail/lib/rewrite.gateway to /mail/lib/rewrite and change YOURDOMAIN.COM with the default domain name that you will use. Things gets tricky here. I host all my email domains and alias under the same account, making my setup very simple. I documented it in a blog post. Basically, I just have to change the headers file to select the right sending identity.

A workaround is to make a script that will determine the account based on the upasname variable. I don’t use this setup so, you will be better informed by the tutorials by mycroftiv or sirjofri.

Once the account problem is fixed, sending an email can be done like this:

mail -s 'Subject'

The window will be on hold, type the body of your message. Once you are done, you can unhold the window by pressing escape. Message will be sent by a final Ctrl+D. Your first email wont get through. Check the smtp logs under /sys/log/ you have to save the smtp certificate hash just like we did when we dealt with IMAP.

echo 'x509 sha256=wKRs7Hc9uafHhMdfSEARYHIAKiUApUfa8u5Aq6/UwTk' >> /sys/lib/tls/smtp

Sending email with acme Mail or nedmail is simpler, but the mail command is practical.