diff --git a/docs/email/email_stack.md b/docs/email/email_stack.md new file mode 100644 index 00000000..43cdba83 --- /dev/null +++ b/docs/email/email_stack.md @@ -0,0 +1,120 @@ +--- +layout: default +title: Current Email Stack +parent: Email +has_children: false +permalink: /email/current-stack +description: "The current stack we use to check email in the terminal" +--- + +# Using Protonmail through the terminal +All of the below stuff assumes you're using protonmail, just because that's what I use. +Before you get started below, please install the [protonmail bridge] on macOS or Linux. + +## `offlineimap` +GET YOUR EMAILS LOCALLY, this time with python. + +Install offlineimap: + +```bash +# this should work on macOS and Linux +brew install offlineimap +``` + +You can view the man pages([1], [2]) in w3m: + +```bash +w3m https://www.offlineimap.org/doc/offlineimap.html +w3m https://www.offlineimap.org/doc/offlineimapui.html +``` + +Edit the config file (`~/.config/offlineimap/config`): + +```toml +# Offlineimap configuration file for protonmail +# +# examples on linux: /home/linuxbrew/.linuxbrew/etc/offlineimap.conf.minimal +# /home/linuxbrew/.linuxbrew/etc/offlineimap.conf + +[general] +accounts = protonmail +# this just runs a line of python to env vars below: from os import environ +pythonfile = ~/.config/offlineimap/offlineimap_account_setup.py +metadata = ~/.cache/offlineimap + +[Account protonmail] +remoterepository = protonmail-remote +localrepository = protonmail-local + +[Repository protonmail-local] +type = Maildir +localfolders = ~/.local/share/offlineimap +sync_deletes = no + +[Repository protonmail-remote] +type = IMAP +# These are just environment variables, and won't work without the python file +remotehosteval = environ["MAIL_SERVER"] +remoteporteval = int(environ["MAIL_PORT"]) +remoteusereval = environ["MAIL_USER"] +remotepasseval = environ["MAIL_PASS"] + +# this part is important for protonmail +starttls = yes +ssl = no +ssl_version = tls1_2 +sslcacertfile = ~/.config/protonmail/bridge/cert.pem +# I don't know what this does +expunge = yes + +# --------- section for what folders and labels you pull ------------ +nametrans = lambda foldername: re.sub ('^Folders.', '', foldername) +folderfilter = lambda foldername: foldername not in ['All Mail'] +``` + +Then, if you chose to use the `remote*eval` parameters above, you'll need +a python file with the following in it: + +```python +# this file would be named whatever you called your pythonfile in your config +#!/usr/bin/env python3.11 +from os import environ +``` + +As an example, my pythonfile above is called, but you could name it anything: +`~/.config/offlineimap/offlineimap_account_setup.py` + +After that, you can go ahead and run: `offlineimap` + +Then you _should_ have all your email locally in `~/.local/share/offlineimap/`. + +## NotMuch +[NotMuch] is an email indexer and tagging system. We'll use it to index our mail, +because neomutt is slow and bad at this part. You can get started with: + +Make sure to set the maildir to `~/.local/share/offlineimap`. + +```bash +notmuch setup +``` + +And after that, you can run notmuch for the first time with: + +```bash +notmuch new +``` + +## NeoMutt +[Neomutt] is an email client TUI (terminal user interface) for viewing and +sending email. + + +## References +It is surprisingly hard to find docs on protonmail via a TUI... so thank you very much to all the authors of these posts below! + +- []() + +[1]: https://www.offlineimap.org/doc/offlineimap.html +[2]: https://www.offlineimap.org/doc/offlineimapui.html +[protonmail bridge]: https://proton.me/mail/bridge "ProtonMail Bridge" +[neomutt]: https://neomutt.org/ "NeoMutt" diff --git a/docs/email/neomutt/neomutt.md b/docs/email/neomutt/neomutt.md index 508d0bcd..aa3f939c 100644 --- a/docs/email/neomutt/neomutt.md +++ b/docs/email/neomutt/neomutt.md @@ -31,7 +31,157 @@ Steps: This will be your password that you can source in your `neomuttrc` which should be located in `~/.config/neomutt/neomuttrc`. -You can check out an [example neomuttrc file](https://github.com/jessebot/dot_files/blob/main/.config/neomutt/neomuttrc) if you'd like. + +
+ Example neomuttrc working with protonmail + +```config +# A first attempt at using neomutt as a primary desktop email client + +# ----------------------- general ------------------------------- +# bell on new mails - even though I normally hate bells +set beep_new + +# -------------------------- Themeing --------------------------- +# basic space_chalk color scheme +source ~/.config/neomutt/themes/spacechalk/neomutt_spacechalk_colors.muttrc + +# powerline for status lines and pager lines +source ~/.config/neomutt/themes/spacechalk/powerline.neomuttrc + +# ------------------------- Temp files --------------------------- +set certificate_file=~/.local/state/neomutt/certificates + + +# ------------- index settings, your list of emails ------------- +# +# No help bar at the top of index +unset help + +# sort the inbox by newest first +set sort = reverse-threads + + +# ----------------- viewing email attachments ------------------- + +# handing MIME types (html, pdf, jpg, gif, etc) +set mailcap_path = ~/.config/neomutt/mailcap + +# view other kinds of plain(ish) text before html +alternative_order text/plain text/enriched text/html text/* + +# set - will always ask for a key after an external command +# unset - wait for key only if the external command returned a non-zero status +unset wait_key + + +# --------- composing email: new messages, replies, and forwards ------------- +# use neovim by default +set editor = "nvim" + +# show headers when composing +set edit_headers + +# format of subject when forwarding +set forward_format = "Fwd: %s" + +# reply to Reply to: field +set reply_to + +# reply to person's name +set reverse_name + +# include message in replies +set include + +# include message in forwards +set forward_quote + +# signature, this gets appended to your emails, you have to create this file +set signature= "~/.config/neomutt/signature" + +# Character set on sent messages: +set send_charset = "utf-8" + +# If there is no charset given on incoming msg, its probably windows: +# set assumed_charset = "iso-8859-1" + +# ----------------- Email address, Password, and Name --------------------- +# sources secret variables from a file that looks like (without comments): +# $my_name="Your Name" +# $my_user="You@yourprovider.tld" +## if protonmail, $my_pass should be the password from protonmail-bridge +# $my_pass="Your Password" +source ~/.config/neomutt/keys + +# --------------------- Key binding and remapping --------------------------- +# In it's own file for organization sake +source ~/.config/neomutt/key_bindings.neomuttrc + +# --------------------------- IMAP settings --------------------------- # +# recieving mail +# Local protonmail-bridge host server: 127.0.0.1 +# Protonmail-bridge imap port: 1143 +# --------------------------------------------------------------------- # +set imap_user = $my_user +set imap_pass = $my_pass + +# ("+" substitutes for `folder`) +set mbox_type = Maildir +set folder = imap://127.0.0.1:1143/ +set record = +Sent +set postponed = +Drafts +# Specify where to save and/or look for postponed messages. +# set postponed = +[Protonmail]/Drafts +set trash = +Trash +set spoolfile = +INBOX +mailboxes = +INBOX +Drafts +Sent +Trash + +# ----------------------------- Caching --------------------------------- +# Store message headers locally to speed things up. If header_cache is a folder, +# Mutt will create sub cache folders for each account which speeds things up more +# ----------------------------------------------------------------------- +# CREATE THIS FOLDER. REMOVE IT IF IT IS A FILE AND CREATE AS FOLDER +set header_cache = ~/.local/state/neomutt + +# --------------------------- Caching 2 --------------------------------- +# Store mail locally to speed things up, like searching message bodies. Can be +# same folder as header_cache. Costs disk space if you have a lot of email +# ----------------------------------------------------------------------- +# I'm using this folder because it's more XDG spec +set message_cachedir = ~/.local/state/neomutt + +# Allow Mutt to open a new IMAP connection automatically. +unset imap_passive + +# Keep the IMAP connection alive by polling intermittently (time in seconds) +# this is 5 minutes +set imap_keepalive = 300 + +# How often to check for new mail (time in seconds). +# this is six minutes +set mail_check = 360 + +# ------------ SMTP (Simple Mail Transfer Protocol) settings ---------- +# sending mail +# Local protonmail-bridge host server: 127.0.0.1 +# Protonmail-bridge smtp port: 1025 +# --------------------------------------------------------------------- +set smtp_pass = $my_pass +set realname = $my_name +set from = $my_user +set use_from = yes + +set smtp_url = smtp://$my_user:$smtp_pass@127.0.0.1:1025 + +# ----------------------- security :shrug: ---------------------------- +set ssl_force_tls = yes +set ssl_starttls = yes +# When set , postponed messages that are marked for encryption will be self-encrypted. NeoMutt will first try to encrypt using the value specified in $pgp_default_key or $smime_default_key. If those are not set, it will try the deprecated $postpone_encrypt_as. (Crypto only) Default: no +# set postpone_encrypt = yes +``` + +
## Nesting virtual folders