.emacs.d/init.d/misc/email.el

71 lines
2.6 KiB
EmacsLisp

;;; email.el --- Email setup -*- lexical-binding: t; -*-
;; Time-stamp: <2020-05-24T22:38:58+0200>
;;; Commentary:
;;; Code:
(require 'basics/package-management)
(when (and (executable-find "mu")
(or (file-exists-p "~/email/tzend")
(file-exists-p "~/.maildir")))
(use-package mu4e
:straight nil ; Installed by package “mu”.
:after (ivy smtpmail)
:commands (mu4e-get-maildirs
mu4e-mark-handle-when-leaving
mu4e-headers-search)
:functions (ivy-completing-read)
:custom ((mu4e-maildir "~/email/tzend")
(mu4e-trash-folder "/Trash")
(mu4e-sent-folder "/Sent")
(mu4e-drafts-folder "/Drafts")
(mu4e-refile-folder "/Keep")
(mu4e-get-mail-command "mbsync -c ~/.config/mbsync/config tzend")
(mu4e-update-interval (* 60 10))
(mu4e-use-fancy-chars t)
(mu4e-view-show-images t)
(mu4e-view-show-addresses t)
;; Don't render HTML.
(mu4e-view-html-plaintext-ratio-heuristic most-positive-fixnum)
(mu4e-attachment-dir "~/Downloads")
(mu4e-compose-signature-auto-include t)
(mu4e-user-agent-string nil)
(mail-user-agent #'mu4e-user-agent))
:config (progn
;; When we are on the mail-server.
(when (file-exists-p "~/.maildir")
(custom-set-variables
'(mu4e-maildir "~/.maildir")
'(mu4e-trash-folder "/.Trash")
'(mu4e-sent-folder "/.Sent")
'(mu4e-drafts-folder "/.Drafts")
'(mu4e-refile-folder "/.Keep")
'(mu4e-get-mail-command "true")
'(mu4e-update-interval nil)))
(defun mu4e~headers-jump-to-maildir ()
"Overload that uses ivy."
(interactive)
(let ((maildir (ivy-completing-read
"Jump to maildir: " (mu4e-get-maildirs))))
(when maildir
(mu4e-mark-handle-when-leaving)
(mu4e-headers-search (format "maildir:\"%s\"" maildir))))))
:bind ("C-X m" . mu4e)))
(use-package smtpmail
:defer 4
:custom ((message-send-mail-function #'smtpmail-send-it)
(mu4e-sent-messages-behavior 'sent)
(smtpmail-smtp-server "mail.tzend.de")
(smtpmail-local-domain "tastytea.de")
(smtpmail-smtp-user "tastytea")
(smtpmail-stream-type 'starttls)
(smtpmail-smtp-service "submission")))
(provide 'misc/email)
;;; email.el ends here