Table of Contents

1 Email setup with mu4e and emacs

I wouldn't advise anybody to set up their own e-mail client with mu4e unless they had a lot of time. Its not really click and play.

Why would you want to do this? Well, its nice to write e-mails in your text editor, where you can use all of emacs text-editing capabilities. Also, you can quickly sort through your mail with keystroke commands for marking e-mail as read, archived or for deletion. If you usually use emacs, you will have a lot of your earlier work on hand for cutting and pasting without having to leave your text editor.

What are the drawbacks? Sending multiple attachments is more complicated without a GUI (unless there is a trick I haven't discovered yet) - I usually end up zipping files and attaching one zipped file instead. Also, since everything is a textfile, you can manage to do strange things like happening to delete the 'To' field. But thats mostly funny. Also, if you mess up you could probably delete all your e-mails. But wouldn't that mostly be nice?

Anyway, this is my setup. I'm going to post it here; if its not useful for anybody else at least I can use it next time I've got to reinstall mu4e. There are four main parts:

  • The mail retrieval agent - for this I use fetchmail. It queries the server for mail.
  • The mail delivery agent - for this I use procmail. procmail moves the mail to the Maildir, which is a folder with one file per e-mail.
  • The mail indexer - this is mu for mu4e (thats the whole point of mu4e).
  • The mail client - this is mu4e.

1.1 Dependencies

These dependencies might change. For Ubuntu (or Xubuntu, like I'm using): sudo apt-get install libgmime-3.0-dev libxapian-dev emacs (assuming you don't already have emacs installed).

1.2 Install mu and mu4e

sudo apt-get install mu (when I ran that, I got the error message that it was part of some package, and then I installed that package) sudo apt-get install mu4e

1.3 Install fetchmail

sudo apt-get install fetchmail

1.4 Install procmail

sudo apt-get install procmail

1.5 Configure fetchmail

Create file .fetchmailrc in home folder if it doesn't exist. These are the contents for me:

# Configuration created Sat Mar 24 20:42:58 2018 by fetchmailconf 1.57
# bouncemail option means an error mail is sent to the sender if the mail is not delivered because of spam filter (or overfull mailbox?)
# no spambounce means spam-blocked mail does not send an error message to sender. This is because most spam uses a false sender adress.
# softbounce means the server keeps permanently undeliverable mail.
# postmaster is the user on the system using fetchmail, "user_name_for_computer" in this case. If it had been root, it would be "postmaster".
# properties is a string value that is ignored by fetchmail but may be used by extension scripts.
# daemon gives how often the mailbox is polled in seconds.
# After fetchmail has fetched the mail, procmail delivers it to ~/Maildir

set postmaster "user_name_for_computer"
set bouncemail
set no spambounce
set softbounce
set properties ""
set daemon 10
poll imap.one.com with proto IMAP
       user 'myemail@mydomain.se' pass '**********' is 'user_name_for_computer' here keep
  mda "/usr/bin/procmail -f %F -d %T";

1.6 Configure procmail

Create file .procmailrc in home folder if it doesn't exist. These are the contents for me:

DEFAULT=$HOME/Maildir/

Create Maildir if it doesn't exist.

1.7 Create file with authentication info for sending mail through smtp

Create file .authinfo . These are the contents for me:

#one.com is my e-mail provider. 

machine send.one.com login myemail@myemail.com port 587
machine send.one.com login myemail@myemail.com password ******* port 587

1.8 Add configuration for mu4e to .emacs

(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
(require 'mu4e)
;; these are actually the defaults
(setq
  mu4e-sent-folder   "/sent"       ;; folder for sent messages
  mu4e-drafts-folder "/drafts"     ;; unfinished messages
  mu4e-trash-folder  "/trash"      ;; trashed messages
  mu4e-refile-folder "/archive")   ;; saved messages
(setq mail-user-agent 'mu4e-user-agent)
(setq mu4e-user-mail-adress "myemailadress@mydomain.se")
(setq mu4e-update-interval 30) ;;If you want it updated fast, lower this from 30 seconds. 
;;
;;Configuration for smtp:
(require 'smtpmail)
(require 'starttls)

 (setq starttls-gnutls-program "gnutls-cli")

(setq
       mail-host-address "myemailadress@mydomain.se"
       starttls-use-gnutls t
       starttls-extra-arguments nil
       smtpmail-smtp-user "myemailadress@mydomain.se";; checked with one.com
       user-mail-address "myemailadress@mydomain.se"
    smtpmail-stream-type 'starttls
   smtpmail-default-smtp-server "send.one.com"
   smtpmail-smtp-server "send.one.com"
   smtpmail-local-domain "mydomain.se";; Checked with one.com
   message-send-mail-function 'smtpmail-send-it
    smtpmail-starttls-credentials '(("send.one.com" 587 nil nil))
     smtpmail-auth-credentials
     '(("send.one.com" 587 "myemailadress@mydomain.se" "PASSWORD"));;
   smtpmail-auth-credentials  (expand-file-name "~/.authinfo")
   smtpmail-debug-info t
   smtpmail-debug-verb t
   smtpmail-smtp-service 587);465

1.9 Server side changes

It was a while since I did this part - you might have to change settings to allow IMAP polling and SMTP sending - I really don't remember and don't know enough about how IMAP and SMTP work to know if that makes sense. There is somewhere a setting for keeping a copy of the e-mails on the server. I do this, because if your homemade setup fails or you (cough cough) happen to remove an important root directory of your folder and your computer stops working then you have a backup - also its nice to be able to check your e-mail on your phone. This is, of course, assuming you have a webclient for your e-mail. It might be the 'keep' word in fetchmailrc that does this, but can't remember and couldn't verify that now. Update: It is the word keep in fetchmailrc that does this.

1.10 Automatically start fetchmail and procmail at boot

In my crontab (for my user, not root) I put:

@reboot fetchmail

@reboot procmail

Hopefully it works!

Author: David

Created: 2022-12-10 lör 01:24

Validate