Skip to content

Instantly share code, notes, and snippets.

@andrwj
Forked from jackbaty/mu4e-config-emacs
Created December 2, 2018 02:30
Show Gist options
  • Save andrwj/342eb9d59519f8f63c4d128919e4e816 to your computer and use it in GitHub Desktop.
Save andrwj/342eb9d59519f8f63c4d128919e4e816 to your computer and use it in GitHub Desktop.
My mail (mu4e) configuration section of .spacemacs
;; Mu4e ------------------------------------------------------------------------
;; Mail Mu4e
(require 'org-mu4e)
(setq mu4e-maildir "~/Mail")
(setq mu4e-user-mail-address-list '("[email protected]" "[email protected]") )
;;store link to message if in header view if nil - header query if t
(setq org-mu4e-link-query-in-headers-mode t)
(setq mu4e-change-filenames-when-moving t)
(setq mu4e-view-prefer-html nil)
(setq mu4e-attachment-dir "~/Desktop")
(setq mu4e-use-fancy-chars nil) ;;
(setq mu4e-view-show-addresses t) ;; I prefer to see both name and address
(setq mu4e-compose-keep-self-cc nil) ;; Don't include my address on CC when replying
(setq mu4e-compose-dont-reply-to-self t) ;; trying because the above doesn't work
(setq mu4e-headers-sort-direction 'ascending)
(setq mu4e-enable-notifications nil)
(setq mu4e-alert-style (quote osx-notifier))
;;(setq mu4e-compose-complete-only-personal t)
(setq mu4e-compose-complete-only-after "2012-01-01")
;;(setq mu4e-compose-in-new-frame t)
(add-to-list 'mu4e-view-actions '("ViewInBrowser" . mu4e-action-view-in-browser) t)
(setq mu4e-sent-folder "/Fastmail/Sent")
(setq mu4e-drafts-folder "/Fastmail/Drafts")
(setq mu4e-refile-folder "/Fastmail/Archive")
(setq mu4e-trash-folder "/Fastmail/trash")
(setq mu4e-get-mail-command "/usr/local/bin/mbsync -a")
(setq message-send-mail-function 'smtpmail-send-it)
(setq send-mail-function 'smtpmail-send-it)
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "smtp.fastmail.com")
(setq smtpmail-smtp-service 465)
(setq smtpmail-stream-type 'ssl)
(add-hook 'mu4e-compose-mode-hook
(lambda ()
(set-fill-column 72)
(auto-fill-mode 0)
(setq mu4e-compose-format-flowed t)
(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
(visual-line-mode)
))
(setq mu4e-maildir-shortcuts
'(("/Fastmail/INBOX" . ?i)
("/Fastmail/SaneLater" . ?l)
))
(setq mu4e-bookmarks
`(("flag:unread AND NOT flag:trashed" "Unread messages" ?u)
("date:today..now" "Today's messages" ?t)
("maildir:\"/Fastmail/Sent\" date:1d..now" "Sent recently" ?r)
("flag:flagged" "Flagged messages" ?f)
("date:7d..now" "Last 7 days" ?w)
))
(setq mu4e-contexts
`( ,(make-mu4e-context
:name "Work"
:enter-func (lambda () (mu4e-message "Entering Work context"))
:leave-func (lambda () (mu4e-message "Leaving Work context"))
;; we match based on the contact-fields of the message
:match-func (lambda (msg)
(when msg
(mu4e-message-contact-field-matches msg
:to "@fusionary.com")))
:vars '( ( user-mail-address . "[email protected]" )
( user-full-name . "Jack Baty" )
( mu4e-compose-signature . nil)
))
,(make-mu4e-context
:name "Personal"
:enter-func (lambda () (mu4e-message "Switch to the Personal context"))
;; no leave-func
;; we match based on the contact-fields of the message
:match-func (lambda (msg)
(when msg
(mu4e-message-contact-field-matches msg
:to "[email protected]")))
:vars '( ( user-mail-address . "[email protected]" )
( user-full-name . "Jack Baty" )
( mu4e-compose-signature . nil)))))
(setq mu4e-context-policy 'pick-first)
(defun djcb-mu4e-copy-message-at-point (&optional dir)
"Copy message at point to somewhere else as <date>_<subject>.eml."
(interactive)
(let* ((msg (mu4e-message-at-point))
(target (format "%s_%s.eml"
(format-time-string "%F" (mu4e-message-field msg :date))
(or (mu4e-message-field msg :subject) "No subject"))))
(copy-file
(mu4e-message-field msg :path)
(format "%s/%s" (or dir (read-directory-name "Copy message to: " "~/Desktop")) target) 1)))
;; (format "%s/%s" "~/Desktop" target) 1)))
(global-set-key (kbd "<f5>") 'djcb-mu4e-copy-message-at-point)
;;/ mu4e ------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment