# Reading my email on the Hurd

### by Joshua Branson — July 11, 2022

;tldr The video of all of this blog post is available here:

https://video.hardlimit.com/w/18NHmZA5sNEgVrZhoq7xna

So recently I re-set up my Emacs to send email. I usually use Emacs’ Gnus mode for reading mailing lists. I have yet to find a better tool to process the sheer amount of email that mailing lists through at you. Gnus is cool, but it’s also a Turing tarpit (that’s another blog post).

So, if you dear reader want to check your mailing lists via Emacs’ Gnus in a Hurd vm, here’s what you want to do:

    $ wget https://cdimage.debian.org/cdimage/ports/latest/hurd-i386/debian-hurd.img.tar.gz
    $ tar -xz < debian-hurd.img.tar.gz

Modify my command to start your Hurd vm to your liking:

    qemu-system-i386 -m 4G  \
        -drive format=raw,cache=writeback,file=./debian-hurd-20220331.img  \
        -net user,hostfwd=tcp:127.0.0.1:2222-:22 -net nic,model=e1000  \
        -no-reboot --enable-kvm

Now that you have the Hurd running in a vm, install emacs and msmtp!

    sudo apt-get install emacs msmtp

Configure msmtp: https://wiki.archlinux.org/title/Msmtp

That means put in this inside your ~/.msmtprc. Change the values to what you need. Check the wiki link above. The arch wiki is awesome!

    # Example for a user configuration file ~/.msmtprc
    #

    # Set default values for all following accounts.
    defaults

    # Use the mail submission port 587 instead of the SMTP port 25.
    port 587

    # Always use TLS.
    tls on

    # Set a list of trusted CAs for TLS. The default is to use system settings, but
    # you can select your own file.
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    logfile ~/.msmtp.log

    # A dismail account
    account dismail.de

    # Host name of the SMTP server
    host smtp.dismail.de

    # Envelope-from address
    from jbranso@dismail.de

    # Authentication. The password is given using one of five methods, see below.
    auth on
    user jbranso@dismail.de

    # Password method 3: Store the password directly in this file. Usually it is not
    # a good idea to store passwords in plain text files. If you do it anyway, at
    # least make sure that this file can only be read by yourself.
    password ReallyAwesomePassword!

    # Set a default account
    account default : dismail.de

    sudo chmod og-rwx ~/.msmtprc

Now you can test make sure that you can send email via msmtp. Check the archlinux wiki page for how to test to see if msmtp works.

Now decide where you want your emacs init file: “~/.emacs” or “~/.emacs.d/init.el”.

    mkdir ~/.emacs.d
    emacs ~/.emacs.d/init.el

And you will put this into your emacs:

    ;; Some functionality uses this to identify you, e.g. GPG configuration, email
    ;; clients, file templates and snippets.
    (setq user-full-name "Joshua Branson"
          user-mail-address "jbranso@dismail.de")

    ;; gmail is "imap.dismail.de"
    ;; fastmail.com is a great paid email solution!
    (setq gnus-select-method '(nnimap "imap.dismail.de"))

    ;; use msmtp
    ;; from the emacs wiki: https://www.emacswiki.org/emacs/GnusMSMTP
    (setq message-send-mail-function 'message-send-mail-with-sendmail)
    ;; we substitute sendmail with msmtp
    (setq sendmail-program "/usr/bin/msmtp")
    ;; This is needed to allow msmtp to do its magic:
    (setq message-sendmail-f-is-evil 't)
    ;;need to tell msmtp which account we're using
    (setq message-sendmail-extra-arguments '("--read-envelope-from"))

    ;; This is optional, but highly reccommended.
    ;; save email replies to my Sent folder
    (setq gnus-posting-styles
          `((".*"
             ;; between the "+" and the ":" put the string for
             ;; gnus-select-method
             (gcc "\"nnimap+imap.dismail.de:Sent\"")
             ;; I use this next line for my dismail filter to mark as read archived messages
             ;; that gnus sends to my Sent folder.
             ;; this next line is optional.  You may delete it.
             ("X-Gnus-Sucks" "I know man")
           )))

Restart Emacs, and `M-x m` your first email!

`M-x Gnus` starts Gnus for the first time. You might need to read the manual or check out a youtube video online to help you set up Gnus for the first time.