#+TITLE: 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 #+begin_src authinfo machine example login jamie@example.com password verysecurepass port imaps machine smtp.example.com login jamie@example.com password verysecurepass port 587 #+end_src * Gnus Config Tell gnus to read ~gnus.el~ from the config dir. #+begin_src emacs-lisp (setq gnus-init-file (expand-file-name "gnus.el" user-emacs-config-directory)) ; (setq gnus-init-file "/home/iang/.config/emacs/gnus.el") #+end_src 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 redundant mail reader. ** 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 #+begin_src emacs-lisp (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)) #+end_src * SMTP Mail Config ** Call required features #+begin_src emacs-lisp (require 'smtpmail) (require 'starttls) #+end_src ** Set Emacs' built in SMTP mail sender method #+begin_src emacs-lisp (setq send-mail-function 'smtpmail-send-it) #+end_src ** Configure the SMTP sender #+begin_src emacs-lisp (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))) #+end_src