;; example configuration for mu4e (add-to-list 'load-path "/home/matt/src/mu/mu4e/" ) (add-to-list 'load-path "/home/matt/src/org-mode/lisp/" ) (add-to-list 'load-path "/home/matt/src/org-mode/contrib/lisp/" ) ;; make sure mu4e is in your load-path (require 'mu4e) (require 'org) (require 'org-mime) ;; Only needed if your maildir is _not_ ~/Maildir ;; Must be a real dir, not a symlink (setq mu4e-maildir "/home/matt/UofTMail/") ;; these must start with a "/", and must exist ;; (i.e.. /home/user/Maildir/sent must exist) ;; you use e.g. 'mu mkdir' to make the Maildirs if they don't ;; already exist ;; below are the defaults; if they do not exist yet, mu4e offers to ;; create them. they can also functions; see their docstrings. (setq mu4e-sent-folder "/Sent") (setq mu4e-drafts-folder "/Drafts") (setq mu4e-trash-folder "/Trash") (setq mu4e-refile-folder "/Archives") ;; smtp mail setting; these are the same that `gnus' uses. (setq ;;message-send-mail-function 'smtpmail-send-it smtpmail-default-smtp-server "smtp.utoronto.ca" smtpmail-smtp-server "smtp.utoronto.ca" smtpmail-local-domain "utoronto.ca") ;; use msmtp instead of sendmail! ;; actually we're using nullmailer now. Both are great, but nullmailer send is subjetively instantaneous (setq message-send-mail-function 'message-send-mail-with-sendmail) ;; instead of sending directly with msmtp, sned with the enqueue script ;;(setq sendmail-program "/usr/local/bin/msmtp-enqueue.sh") (setq sendmail-program "/usr/bin/sendmail") ;;(setq sendmail-program "/usr/bin/msmtp") ;;; This line allows you to store a quick link to the relevant email in a TODO item. ;;; thank you, Pragmatic Emacs: http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/ ;;store org-mode links to messages (require 'org-mu4e) ;;store link to message if in header view, not to header query (setq org-mu4e-link-query-in-headers-mode nil) ;; the maildirs you use frequently; access them with 'j' ('jump') (setq mu4e-maildir-shortcuts '(("/inbox" . ?i) ("/Archives" . ?a) ("/Sent" . ?s))) ;; a list of user's e-mail addresses (setq mu4e-user-mail-address-list '("address@hidden" "address@hidden")) ;; when you want to use some external command for text->html ;; conversion, e.g. the 'html2text' program ;; (setq mu4e-html2text-command "html2text") ;; commenting out for testing ;; (require 'mu4e-contrib) ;; (setq mu4e-html2text-command 'mu4e-shr2text) ;; (add-hook 'mu4e-view-mode-hook ;; (lambda() ;; ;; try to emulate some of the eww key-bindings ;; (local-set-key (kbd "") 'shr-next-link) ;; (local-set-key (kbd "") 'shr-previous-link))) ;; the headers to show in the headers list -- a pair of a field ;; and its width, with `nil' meaning 'unlimited' ;; (better only use that for the last field. ;; commenting out for testing ;; These are the defaults: ;; (setq mu4e-headers-fields ;; '( (:human-date . 25) ;; alternatively, use :human-date ;; (:flags . 6) ;; (:mailing-list . 10) ;; ;;(:attachments . 6) ;; (:from-or-to . 22) ;; (:subject . nil))) ;; alternatively, use :thread-subject ;; program to get mail; alternatives are 'fetchmail', 'getmail' ;; isync or your own shellscript. called when 'U' is pressed in ;; main view. ;; If you get your mail without an explicit command, ;; use "true" for the command (this is the default) (setq mu4e-get-mail-command "offlineimap") ;; general emacs mail settings; used when composing e-mail ;; the non-mu4e-* stuff is inherited from emacs/message-mode (setq mu4e-reply-to-address "address@hidden" user-mail-address "address@hidden" user-full-name "Matt Price") (setq mu4e-compose-signature "") ;; smtp mail setting ;; I don't think this is being used by nullmailer at all, so probably irrelefant for me. ;; (setq ;; ;; if you need offline mode, set these -- and create the queue dir ;; ;; with 'mu mkdir', i.e.. mu mkdir /home/user/Maildir/queue ;; smtpmail-queue-mail nil ;; smtpmail-queue-dir "/home/matt/UofTMail/queue/cur") ;; don't keep message buffers around ;; commenting out in case this is an issue. ;;(setq message-kill-buffer-on-exit t) ;; commenting out for troubleshooting. ;; split horizontally, which is how I like it ;; actually, switch to vertical (which is bizarrely called horizontal) ;; can't seem to get it to switch, so we'll see how it goes. ;; (setq ;; mu4e-split-view 'horizontal ;; mu4e-headers-visible-lines 15 ;; mu4e-headers-visible-columns 80) ;; view images inline ;; enable inline images ;; (setq mu4e-view-show-images t) ;; ;; use imagemagick, if available ;; (when (fboundp 'imagemagick-register-types) ;; (imagemagick-register-types)) ;; extract attachments ;; consider doing some sorting, e.g.: http://www.djcbsoftware.nl/code/mu/mu4e/Attachments.html#Attachments (setq mu4e-attachment-dir "~/Downloads") (setq mu4e-attachment-dir (lambda (fname mtype) (cond ;; jpgs go to ~/Pictures/FromEmails ((and fname (string-match "\\.jpg$" fname)) "~/Pictures/FromEmails") ;; ... other cases ... (t "~/Downloads")))) ;; everything else ;; ;; This is a rewrite if mu4e-main from [[https://github.com/zmalltalker/dot-emacs/blob/master/contrib/mu4e/mu4e-main.el]] ;; (eval-after-load 'mu4e ;; '(define-key mu4e-main-mode-map "m" 'mu4e-main-toggle-mail-sending-mode)) ;; (eval-after-load 'mu4e ;; '(define-key mu4e-main-mode-map "f" 'smtpmail-send-queued-mail)) ;; comment out all my new keybindings ;; (defun my-mu4e-main-mode-config () ;; "For use in `mu4e-main-mode-hook'." ;; (local-set-key (kbd "m") 'mu4e-main-toggle-mail-sending-mode) ; add a key ;; (local-set-key (kbd "f") 'smtpmail-send-queued-mail) ; add a key ;; ;;(local-set-key (kbd "C-c C-p") nil) ; example of remove a key ;; ;; more here ;; ) ;; (defun my-mu4e-headers-mode-config () ;; "For use in 'mu4e-view-mode-hook'." ;; (local-set-key (kbd "a") 'mu4e-headers-mark-for-refile) ;; remap from "r" ;; (local-set-key (kbd "r") 'mu4e-compose-reply) ;; add new keymapping, along with "R" ;; (local-set-key (kbd "C-c C-v") 'mu4e-headers-action) ;; rebind from a ;; ) ;; (defun my-mu4e-view-mode-config () ;; "For use in 'mu4e-view-mode-hook'." ;; (local-set-key (kbd "a") 'mu4e-view-mark-for-refile) ;; remap from "r" ;; (local-set-key (kbd "r") 'mu4e-compose-reply) ;; add new keymapping, along with "R" ;; (local-set-key (kbd "C-c C-v") 'mu4e-view-action) ;; rebind from a ;; (visual-line-mode) ;; ) ;; (define-key mu4e-headers-mode-map (kbd "C-c c") 'org-mu4e-store-and-capture) ;; (define-key mu4e-view-mode-map (kbd "C-c c") 'org-mu4e-store-and-capture) ;; (define-key mu4e-headers-mode-map "x" #'my-mu4e-mark-execute-all-no-confirm) ;; turn off execution ocnfirmation ;; ;; add to hook ;; (add-hook 'mu4e-main-mode-hook 'my-mu4e-main-mode-config) ;; (add-hook 'mu4e-headers-mode-hook 'my-mu4e-headers-mode-config) ;; (add-hook 'mu4e-view-mode-hook 'my-mu4e-view-mode-config) ;; configure view actions (add-to-list 'mu4e-view-actions '("ViewInBrowser" . mu4e-action-view-in-browser) t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Interactive functions ;; (defun my-mu4e-mark-execute-all-no-confirm () ;; "Execute all marks without confirmation." ;; (interactive) ;; (mu4e-mark-execute-all 'no-confirm)) ;; this seemed essential at first but now I'm not using the mstpmail queue ;; (defun mu4e-main-toggle-mail-sending-mode () ;; "Toggle sending mail mode, either queued or direct." ;; (interactive) ;; (unless (file-directory-p smtpmail-queue-dir) ;; (mu4e-error "`smtpmail-queue-dir' does not exist")) ;; (setq smtpmail-queue-mail (not smtpmail-queue-mail)) ;; (message ;; (concat "Outgoing mail will now be " ;; (if smtpmail-queue-mail "queued" "sent directly"))) ;; (mu4e~main-view)) ;; use flowed text in ocmpose mode os your emails don't look awful ;; tip submitted by mu4e user cpbotha (from manual, appendix) ;; unfortunatley this seems to interfere with John Kitchin;sstuff. Disabling for now, ;; will submit report ;; (add-hook 'mu4e-compose-mode-hook ;; (defun cpb-compose-setup () ;; "Outgoing mails get format=flowed." ;; (use-hard-newlines t 'guess))) ;; this might be overlapping with the below... ;; in fact it almost certainly is ;; (add-hook 'mu4e-compose-mode-hook ;; (defun do-compose-stuff () ;; "My settings for message composition." ;; (org-mu4e-compose-org-mode))) ;; make use of org-mode in ocmposition mode, and show html versions by defaul... ;; I think there might be a conflict with org-mu4e-convert-to-html t ;; Since I seem to have discovered the problem elsewhere, I'll consider changing this back ;; soon. ;; (setq ;; org-mu4e-convert-to-html t ;; mu4e-view-prefer-html t) ;; john kitchin's trick to check for attachments: ;; http://kitchingroup.cheme.cmu.edu/blog/category/email/ (defun org-mime-org-buffer-htmlize () "Create an email buffer containing the current org-mode file exported to html and encoded in both html and in org formats as mime alternatives." (interactive) (org-mime-send-buffer 'html) (message-goto-to)) (defun org-mime-subtree () "Create an email buffer containing the current org-mode subtree exported to a org format or to the format specified by the MAIL_FMT property of the subtree." (interactive) (org-mime-send-subtree (or (org-entry-get nil "MAIL_FMT" org-mime-use-property-inheritance) 'org)) (message-goto-to)) (defun mu4e-compose-org-mail () (interactive) (mu4e-compose-new) (org-mu4e-compose-org-mode)) (defun htmlize-and-send () "When in an org-mu4e-compose-org-mode message, htmlize and send it." (interactive) ;;(message "hello") (when (member 'org~mu4e-mime-switch-headers-or-body post-command-hook) (goto-char (point-min)) (org-mime-htmlize) (message-send-and-exit))) (add-hook 'org-ctrl-c-ctrl-c-hook 'htmlize-and-send t) (defun mwp-send-from-org () "when in org-mu4e-compose-org-mode message, just send it b/c htmlize has already been hooke in" (interactive) (when (member 'org~mu4e-mime-switch-headers-or-body post-command-hook) (goto-char (point-min)) (message-send-and-exit))) ;;(add-hook 'org-ctrl-c-ctrl-c-hook 'mwp-send-from-org t)