mu-wizard icon indicating copy to clipboard operation
mu-wizard copied to clipboard

mu4e configuration wizard

#+TITLE: mu-wizard #+AUTHOR: Cem Keylan #+STARTUP: indent

=mu-wizard= is a shell script to auto-configure email accounts for =mu4e= similar in function to =mutt-wizard=. It uses =isync= to synchronize mail accounts, =msmtp= to send mail and creates individual Lisp profiles for each account. It is still WIP. Expect breaking changes until the first release.

  • Table of Contents :TOC:noexport:
  • [[#dependencies][Dependencies]]
  • [[#installation][Installation]]
    • [[#initiating-password-managers][Initiating password managers]]
  • [[#usage][Usage]]
    • [[#emacs-configuration][Emacs Configuration]]
    • [[#domains-file][Domains file]]
    • [[#overrides][Overrides]]
  • [[#configuration][Configuration]]
    • [[#forcing-a-password-manager][Forcing a password manager]]
    • [[#setting-notification-program][Setting notification program]]
  • [[#notes][Notes]]
    • [[#isync-deprecation-notice][Isync Deprecation Notice]]
    • [[#protonmail][Protonmail]]
    • [[#google][Google]]
  • Dependencies
  • =isync= (for offline mail storage)
  • =mu= (or =maildir-utils= depending on your distribution)
  • =msmtp= (for sending mails)
  • Password manager (=pass=, [[https://github.com/dylanaraps/pash][pash]], and [[https://github.com/cemkeylan/pm][pm]] is supported)
  • Installation

In order to install =mu-wizard=, clone this repository and build =mu-wizard=.

#+BEGIN_SRC sh git clone https://github.com/cemkeylan/mu-wizard.git cd mu-wizard make install #+END_SRC

Users of Arch Linux based distributions can install =mu-wizard= through the AUR package [[https://aur.archlinux.org/packages/mu-wizard-git][mu-wizard-git]]. This package is not maintained by me.

#+BEGIN_SRC sh yay -S mu-wizard-git #+END_SRC

** Initiating password managers

All of the password managers require some sort of initializing before you can store your passwords. This must be done before you run ~muw~ for the first time. You will need to have a GnuPG key for all of the password managers supported by ~muw~. You can create a GPG key by running ~gpg --gen-key~, or ~gpg --full-gen-key~.

See the documentation of your password manager for more information on setting up your password manager, below are simple instructions enough to get you going.

*** pass

In order to initiate pass, do the following:

#+BEGIN_SRC sh pass init [email protected] #+END_SRC

*** pash

In order to use pash, add the following to your =.bashrc= (or what have you):

#+BEGIN_SRC sh export [email protected] #+END_SRC

*** pm

In order to use pm, add the following to your =.bashrc= (or what have you):

#+BEGIN_SRC sh export [email protected] #+END_SRC

  • Usage

The wizard is called by running ~muw~. The commands below are available to use:

#+BEGIN_SRC sh :results raw :exports results ./bin/muw --help | sed -E '/^Commands:/,/^$/!d;/Commands:/d;/^$/d;s|^ ([a-zA-Z-]) (.)$|- =\1= :: \2|' #+END_SRC

#+RESULTS:

  • =add= :: Add and autoconfigure an email address
  • =delete= :: Pick an account to delete
  • =list= :: List configured accounts
  • =purge= :: Purge all configuration
  • =sync= :: Sync mail for accounts
  • =mu-init= :: Run 'mu init' with the configured accounts
  • =data= :: Output system data directory and exit

You can run ~muw COMMAND --help~ for learning more about the usage of the command. The entire documentation can be found on manual pages.

** Emacs Configuration

Emacs will not be loading the configurations, you will need to set it manually. In your init file, you may choose to load the configuration in the following ways.

#+BEGIN_SRC emacs-lisp (load-file "~/.config/mu4e/mu4e-config.el") #+END_SRC

#+BEGIN_SRC emacs-lisp (add-to-list 'load-path "~/.config/mu4e") (require 'mu4e-config) #+END_SRC

#+BEGIN_SRC emacs-lisp (use-package mu4e-config :after mu4e :load-path "~/.config/mu4e") #+END_SRC

** Domains file

=mu-wizard= doesn't come with a predefined =domains.csv= file, but it can use one if it is found on =/usr/share/mu-wizard/domains.csv= (or whatever your share directory is, see ~muw data~). =mu-wizard= also saves the domain information that you when creating an account on your configuration directory, so you don't have to retype every detail when creating a second account with the same domain.

** Overrides

Domain-level overrides are possible by adding a shell file to either the share directory or the user configuration directory. See [[file:overrides/protonmail.com][overrides/protonmail.com]] for an example override.

  • Configuration

=mu-wizard= is mostly configured through environment variables. You can set these variables on your =.bashrc= (or other relevant shell configuration file).

** Forcing a password manager

Using the =$MUW_PWM= environment variable, you can specify which password manager to use. If you don't specify a password manager, ~muw~ will use it with the following order:

  1. ~pass~
  2. ~pash~
  3. ~pm~

** Setting notification program

=mu-wizard= supports ~notify-send~ (from =libnotify=) and [[https://github.com/dudik/herbe][herbe]] for sending mail notifications. You can set the =$MUW_NOTIFY= environment variables to the following:

  1. ~libnotify~
  2. ~herbe~
  3. ~disabled~ (self-explanatory)
  • Notes

** Isync Deprecation Notice

=isync= version 1.4.0 outputs the following deprecation notice for the mbsync configuration.

#+BEGIN_QUOTE Notice: Master/Slave are deprecated; use Far/Near instead. #+END_QUOTE

You can fix this by running the command:

#+begin_src sh sed -i 's|^Slave |Near |;s|^Master |Far |' "$HOME/.mbsyncrc" #+end_src

** Protonmail

=mu-wizard= supports protonmail. If you are using one of the default domains, you don't have to do anything. If you are using an alternative domain, you can link the protonmail.com override to your personal domain. Here is an example:

#+BEGIN_SRC sh ln -sf /usr/share/mu-wizard/overrides/protonmail.com $HOME/.config/mu4e/overrides/example.com #+END_SRC

Keep in mind that you will need protonmail bridge in order to send mails.

** Google

Google requires you to enable less-secure access in order to receive mail. See [[https://support.google.com/accounts/answer/6010255][here]] for more information.