commit d58bbbcec62b34bb06eee3976f291ce8ec63ceec
parent 330fa87b3abbf79e835c32ad49a81bd40973e01c
Author: Gabriel G. de Brito <me@gboncoffee.dev.br>
Date: Sun, 5 Apr 2026 13:15:04 -0300
Setup email.
Diffstat:
| A | .mbsyncrc | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
| M | emacs/config.org | | | 66 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- |
| A | msmtp/config | | | 21 | +++++++++++++++++++++ |
3 files changed, 127 insertions(+), 3 deletions(-)
diff --git a/.mbsyncrc b/.mbsyncrc
@@ -0,0 +1,43 @@
+IMAPAccount icloud
+Host imap.mail.me.com
+User gabrielgbrito@icloud.com
+PassCmd "gpg -q --for-your-eyes-only -d ~/etc/pass/icloud-mail.gpg"
+TLSType IMAPS
+CertificateFile /etc/ssl/certs/ca-certificates.crt
+
+IMAPStore icloud-remote
+Account icloud
+
+MaildirStore icloud-local
+Subfolders Verbatim
+Path ~/mail/icloud/
+Inbox ~/mail/icloud/inbox
+
+Channel icloud
+Far :icloud-remote:
+Near :icloud-local:
+Patterns *
+Create Both
+SyncState *
+
+IMAPAccount dinf
+Host mx.inf.ufpr.br
+User ggb23
+PassCmd "gpg -q --for-your-eyes-only -d ~/etc/pass/dinf.gpg"
+TLSType IMAPS
+CertificateFile /etc/ssl/certs/ca-certificates.crt
+
+IMAPStore dinf-remote
+Account dinf
+
+MaildirStore dinf-local
+Subfolders Verbatim
+Path ~/mail/dinf/
+Inbox ~/mail/dinf/inbox
+
+Channel dinf
+Far :dinf-remote:
+Near :dinf-local:
+Patterns *
+Create Both
+SyncState *
diff --git a/emacs/config.org b/emacs/config.org
@@ -138,6 +138,12 @@ Disable the audible bell.
(setq ring-bell-function 'ignore)
#+END_SRC
+Setup auth sources.
+
+#+BEGIN_SRC emacs-lisp
+(setq auth-sources '("~/.authinfo.gpg"))
+#+END_SRC
+
**** TODO Fix this
Disable local variables. For some reason, Emacs would sometimes call ~file-remote-p~ on nil inside of ~hack-local-variables~ and completely break.
@@ -297,11 +303,9 @@ The best git UI in the world.
(setq magit-completing-read-function 'magit-ido-completing-read))
#+END_SRC
-It's better to use ~forge~ than ~magit-gh~. ~forge~ is very complete. We need to properly setup ~auth~ though.
+It's better to use ~forge~ than ~magit-gh~. ~forge~ is very complete.
#+BEGIN_SRC emacs-lisp
-(setq auth-sources '("~/.authinfo"))
-
(use-package forge
:after magit)
#+END_SRC
@@ -388,6 +392,62 @@ Emacs MultiMedia System.
(setq emms-source-file-default-directory "~/music/"))
#+END_SRC
+*** Email
+
+For reading, I use ~mu4e~. The messages are fetched via ~mbsync~. Both need to be installed system-wide. The ~mbsync~ package sometimes is called ~isync~. For sending, I use ~msmtp~. Also needed to be installed system-wide. It's symlinked to ~sendmail~.
+
+#+BEGIN_SRC emacs-lisp
+(use-package mu4e
+ :ensure nil
+ :bind (("C-c e" . mu4e))
+ :config
+ (setq mu4e-change-filenames-when-moving t)
+ (setq mu4e-update-interval 600)
+ (setq mu4e-get-mail-command "mbsync -a")
+ (setq mu4e-maildir "~/mail")
+ (setq mu4e-compose-signature "Please no HTML,\n~ Gabriel G. de Brito")
+
+ (setq send-mail-function 'sendmail-send-it)
+ (setq mail-user-agent 'mu4e-user-agent)
+ (set-variable 'read-mail-command 'mu4e)
+ (setq mail-specify-envelope-from t)
+ (setq message-sendmail-envelope-from 'header)
+ (setq mail-envelope-from 'header)
+
+ (setq mu4e-contexts (list
+ (make-mu4e-context
+ :name "icloud"
+ :match-func
+ (lambda (msg)
+ (when msg
+ (string-prefix-p "/icloud" (mu4e-message-field msg :maildir))))
+ :vars '((user-mail-address . "me@gboncoffee.dev.br")
+ (user-full-name . "Gabriel de Brito")
+ (mu4e-drafts-folder . "/icloud/Drafts")
+ (mu4e-sent-folder . "/icloud/Sent")
+ (mu4e-trash-folder . "/icloud/Trash")))
+ (make-mu4e-context
+ :name "dinf"
+ :match-func
+ (lambda (msg)
+ (when msg
+ (string-prefix-p "/dinf" (mu4e-message-field msg :maildir))))
+ :vars '((user-mail-address . "ggb23@inf.ufpr.br")
+ (user-full-name . "Gabriel de Brito")
+ (mu4e-drafts-folder . "/dinf/Drafts")
+ (mu4e-sent-folder . "/dinf/Sent")
+ (mu4e-trash-folder . "/dinf/Trash")))))
+
+ (setq mu4e-maildir-shortcuts
+ '(("/icloud/inbox" . ?i)
+ ("/dinf/inbox" . ?d)))
+
+ (setq mu4e-context-policy 'pick-first)
+
+ (setq mml-secure-openpgp-signers '("ABE72DFCAD2D5333FE3F8912F6C1E4A22E8C1F3D"))
+ (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime))
+#+END_SRC
+
*** Miscelaneous
Lice to add licenses.
diff --git a/msmtp/config b/msmtp/config
@@ -0,0 +1,21 @@
+defaults
+auth on
+protocol smtp
+tls on
+tls_starttls on
+
+account icloud
+host smtp.mail.me.com
+port 587
+user gabrielgbrito
+from me@gboncoffee.dev.br
+passwordeval "gpg -q --for-your-eyes-only -d ~/etc/pass/icloud-mail.gpg"
+
+account dinf
+host mx.inf.ufpr.br
+port 587
+user ggb23
+from ggb23@inf.ufpr.br
+passwordeval "gpg -q --for-your-eyes-only -d ~/etc/pass/dinf.gpg"
+
+account default : icloud