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

66 lines
2.4 KiB
EmacsLisp

;;; email.el --- Email setup -*- lexical-binding: t; -*-
;; Time-stamp: <2020-03-31T01:55:53+0200>
;;; Commentary:
;;; Code:
(require 'basics/package-management)
(when (or (and (executable-find "mu")
(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-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
: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