3.9 KiB
Email Configuration
Initial Setup
Before installing any packages with emacs, there is some initial setup that needs to be done. The first part of this is installing isync. Isync is the actual program that is used to sync mail with remote imap servers such as the one used by gmail.
This can be installed with the following command:
sudo pacman -S isync
After this is installed, a config file must be created at the location ~/.mbsyncrc
to configure isync to connect to some gmail account. I've included this in the git repo, so after installing everything with stow .
, it should already be configured properly. However, some information such as the username and password might need to be updated.
The password uses GPG to decrypt some encrypted password file for added security. To create this file, run the following commands:
vim ~/.passwords/gmail # Add your password to the file.
gpg -c ~/.passwords/gmail # Creates a gmail.gpg file.
rm ~/.passwords/gmail # Remove the plaintext password file.
Disclaimer
If you are using two factor authentication, this will not work. In this case, you will need to create an app password. A guide on how to do this can be found here. From here, I can just replace this value with what used to be my normal password.
Mu4e
In this section, I'm setting up mu4e
to give emacs the capability to send emails using my gmail account. To start, you need to install the mu4e
package outside of emacs.
yay -S mu
After installing the mu
client, I also need to run a initial index using the following command:
mbsync -a
mu init --maildir=~/Mail --my-address=jadenprovost@gmail.com
mu index
From here, I can continue onto configuring the mu4e
emacs package.
(use-package mu4e
:ensure nil
:load-path "/usr/share/emacs/site-lisp/mu4e/"
:bind ("C-x m" . mu4e)
:config
;; Avoids syncing issues.
(setq mu4e-change-filenames-when-moving t)
;; Fix message citation style for gmail.
(setq message-cite-style message-cite-style-gmail)
(setq message-citation-line-format "On %a, %b %d, %Y at %H:%M %p %f wrote:")
(setq message-citation-line-function 'message-insert-formatted-citation-line)
;; Refresh mail every X seconds. Set to 5 minutes currently
(setq mu4e-update-interval (* 5 60))
(setq mu4e-get-mail-command "mbsync -a")
(setq mu4e-maildir "~/Mail")
(setq mu4e-drafts-folder "/[Gmail]/Drafts")
(setq mu4e-sent-folder "/[Gmail]/Sent Mail")
(setq mu4e-refile-folder "/[Gmail]/All Mail")
(setq mu4e-trash-folder "/[Gmail]/Trash")
(setq mu4e-maildir-shortcuts
'((:maildir "/Inbox" :key ?i)
(:maildir "/[Gmail]/Sent Mail" :key ?s)
(:maildir "/[Gmail]/Trash" :key ?t)
(:maildir "/[Gmail]/Drafts" :key ?d)
(:maildir "/[Gmail]/All Mail" :key ?a))))
Adding some configuration to correct mu4e
's default values.
(setq user-full-name "Jaden Provost Maxwell-Comfort")
(setq user-mail-address "jadenprovost@gmail.com")
SMTP
In order to send mail with mu4e
, you must also configure an SMTP client. Based on the mu4e
wiki, I was able to shamelessly steal some of the config for the gmail configuration found here.
(use-package smtpmail
:config
(setq smtpmail-stream-type 'ssl)
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 465))
When running this however, you need to authenticate by creating an ~/.authinfo
file. This file is formatted as follows:
machine mail.example.org port 25 login myuser password mypassword
Similarly to the password configured above for the IMAP server, you can also pass an authinfo.gpg
file for some added security.