emacs-config/init.org.d/60-mail.org

2.6 KiB

Mail Configuration

Intro

Gnus is one of the builtin mail cients in Emacs. Gnus is chosen because it is built-in into Emacs, and has all the features for modern electronic mail like IMAP and SMTP support built-in. Gnus has it's own configuration file, that is gnus.el, in the root of this config folder, so this file only sets the things before gnus.el is read

Personal Informations

Most informations for the Email setup is not set here, but in the personal.el in the root of the Emacs config directory. If the personal.el file doesn't exist, copy the personal-sample.el file and fill in your credential and Email informations, as well other personal informations in the file. This is done so that the writer of this config doesn't have to put their personal info online.

Passwords

passwords are stored in the .authinfo / .authinfo.gpg (please don't put file containing passwords in a plain text file, encrypt them). the .authinfo contents should look like this

machine example login jamie@example.com password verysecurepass port imaps
machine smtp.example.com login jamie@example.com password verysecurepass port 587

Gnus Config

Tell gnus to read gnus.el from the config dir.

  (setq gnus-init-file (expand-file-name "gnus.el" user-emacs-config-directory))
  ; (setq gnus-init-file "/home/iang/.config/emacs/gnus.el")

other configuration on gnus is on the gnus.el file.

RMail Config

Even though Gnus is used as the main E-Mail reader, Rmail is also setup as a backup mail reader incase gnus became unused

Dependencies

Since RMail is only a Mail Reader, E-Mails needs to be fetched using external programs. And those external programs are;

  • isync / mbsync to fetch mail into maildirs
  • Mailutils' movemail to move them to RMail's format

Configuration

  (setq rmail-primary-inbox-list
        `( ,(concat "maildir://" (expand-file-name ".local/mails/disroot/INBOX" (safe-getenv "HOME" user-home-path)))
           "/var/spool/mail/iang")
        rmail-preserve-inbox 1
        rmail-mime-prefer-html nil
        rmail-file-name (expand-file-name "mails/inbox" user-emacs-directory))

SMTP Mail Config

Set Emacs' built in SMTP mail sender method

  (setq send-mail-function 'smtpmail-send-it)

Configure the SMTP sender

  (setq smtpmail-smtp-server (cdr (assoc 'smtp-url main-mail-server))
        smtpmail-stream-type (cdr (assoc 'smtp-stream main-mail-server))
        smtpmail-smtp-service (cdr (assoc 'smtp-port main-mail-server)))