Sending messages from the outer space

email on Plan 9

This setup will work on Plan 9 but 9front is highly recommended. 9front highly enhanced how mailbox indexing is handled.

Basic setup

Storing password

Spin up a temporary directory and add your passwords in a file.

% ramfs -p
% cd /tmp
% echo 'key proto=pass server=imap.something.net service=imap user=youruser !password=yourpassword' >> tmp.pass
% echo 'key proto=pass server=smtp.something.net service=smtp user=youruser !password=yourpassword' >> tmp.pass
N.B. You can add as many lines as you want.

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. By default, factotum keep the passwords during a filesystem’s life. Adding the previous command to your profile fixes this “issue”.

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

Opening multiple maiboxes

Add mailboxes to the mail file server.

% echo 'open /imaps/imap.something.net/youruser/maildir maildir' > /mail/fs/ctl
% echo 'open /imaps/imap.something.net/youruser/maildir2 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.

The first fetching run will get you the following error:

echo: write error: imap.something.net/imaps:cert for imap.something.net not recognized: sha256=wKRs7Hc9uafHhMdfSEARYHIAKiUApUfa8u5Aq6/UwTk

Import the certificate hash to fix this error.

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

Notification with faces

Use faces(1) to read your mailboxes.

% faces -im /mail/fs/maildir -im /mail/fs/maildir2

Mail clients

The mail command will take care of opening mailboxes and sending emails. acme also have its mail client. Execute Mail in acme to open your mailbox.

Switching between mailboxes

mail
: mb maildir2

Sending mail