Configuring Mutt with Gmail

Recently, I found myself in the position of having to send a patch to the linux kernel, specifically, a minor documentation fix. I followed the suggestion of this tutorial https://opensource.com/article/18/8/first-linux-kernel-patch to send the patch through Mutt

To configure mutt, I created the .muttrc file in the $HOME folder of my user with the following content, replacing __your_user__ with my user and __your_app_password with my application password (I will explain it later).

# ================  IMAP ====================
set imap_user = '__youruser__@gmail.com'
set imap_pass = '__your_app_password__'
set spoolfile = imaps://imap.gmail.com/INBOX
set folder = "imaps://imap.gmail.com:993"
set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"

# ================  SMTP  ====================
set smtp_url = "smtp://__youruser__@gmail.com@smtp.gmail.com:587/"
set smtp_pass = $imap_pass
set ssl_starttls = yes # activate TLS if available
set ssl_force_tls = yes # Require encrypted connection

# ================  Composition  ====================
set editor = `echo \$EDITOR`
set edit_headers = yes  # See the headers when editing
set charset = UTF-8     # value of $LANG; also fallback for send_charset
# Sender, email address, and sign-off line must match
unset use_domain        # because joe@localhost is just embarrassing
set realname = "John Smith"
set from = "__your_user__@gmail.com"
set use_from = yes

To generate an application password, it was necessary to do two steps at: https://myaccount.google.com

1. In the menu on the right, click on “Security”. Then, in the “Signing in to Google” section, enable “Two-Step Verification”.

  1. In the menu on the right, click on “Security”. Then, in the “Signing in to Google” section, select App Passwords, generate a new one to use it with Mutt.

Thanks to this I was able to send the patch like this:

mutt -H /tmp/0001-Update-the-documentation-referencing-Plan-9-from-Use.patch

Previously, to get the list of maintainers of that section of the code, I downloaded this perl script: https://github.com/torvalds/linux/blob/master/scripts/get_maintainer.pl

And running it from the folder or directory where we have downloaded the kernel code, we will get the list of email addresses to which we could send the patch for its review.

e.g.:

$HOME/bin/get_maintainer.pl /tmp/0001-Update-the-documentation-referencing-Plan-9-from-Use.patch

Tags

  • #kernel
  • #linux
  • #mutt