I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Email
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle email.el :comments org
  5. #+PROPERTY: header-args :results silent :eval no-export :comments org
  6. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  7. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  8. #+ATTR_ORG: :width 420px
  9. #+ATTR_HTML: :width 420px
  10. #+ATTR_LATEX: :width 420px
  11. [[../docs/images/2021-02-13-example-mu4e.gif]]
  12. Plain text email delivered via *mu*[fn:1], *mu4e*[fn:2] and *mbsync*[fn:3]. I run my *own email server*[fn:4], so your configuration may differ from mine.
  13. * Sync
  14. :PROPERTIES:
  15. :header-args: :tangle ../config/mbsyncrc :comments org
  16. :END:
  17. This is the *mbsyncrc*[fn:3] file I use to synchronize my local mail with my server.
  18. #+begin_src conf
  19. IMAPStore xyz-remote
  20. Host mail.chrishayward.xyz
  21. User chris@chrishayward.xyz
  22. PassCmd "pass chrishayward.xyz/chris"
  23. SSLType IMAPS
  24. MaildirStore xyz-local
  25. Path ~/.cache/mail/
  26. Inbox ~/.cache/mail/inbox
  27. SubFolders Verbatim
  28. Channel xyz
  29. Master :xyz-remote:
  30. Slave :xyz-local:
  31. Patterns * !Archives
  32. Create Both
  33. Expunge Both
  34. SyncState *
  35. #+end_src
  36. The system typically expects to find this file at ~$HOME/.mbsyncrc~, but you may also specify a custom path if launching the command using arguments. I chose to symlink the default location to my repository.
  37. * Indexing
  38. :PROPERTIES:
  39. :header-args: :tangle no
  40. :END:
  41. Once mail has been synchronized you need to index it using *mu*[fn:1].
  42. #+begin_src shell
  43. mbsync -a
  44. mu index --maildir="~/.cache/mail"
  45. #+end_src
  46. * Integration
  47. After syncing and indexing the mail is ready to be used inside of Emacs. Download and install *mu4e*[fn:2] and configure the *mail account*[fn:3].
  48. + Update every 5 minutes
  49. + Scale text for all devices
  50. + Sign outbound mail with GPG key
  51. + Configure mail account(s)
  52. #+begin_src emacs-lisp
  53. (use-package mu4e
  54. :load-path "/usr/share/emacs/site-lisp/mu4e"
  55. :custom (mu4e-maildir "~/.cache/mail")
  56. (mu4e-update-interval (* 5 60))
  57. (mu4e-get-mail-command "mbsync -a")
  58. (mu4e-compose-format-flowed t)
  59. (mu4e-change-filenames-when-moving t)
  60. (message-send-mail-function 'smtpmail-send-it)
  61. (mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  62. (mu4e-compose-signature (concat "Chris Hayward\n"
  63. "https://chrishayward.xyz\n"))
  64. :config
  65. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  66. (setq mu4e-contexts
  67. (list
  68. ;; Main
  69. ;; chris@chrishayward.xyz
  70. (make-mu4e-context
  71. :name "Main"
  72. :match-func
  73. (lambda (msg)
  74. (when msg
  75. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  76. :vars
  77. '((user-full-name . "Christopher James Hayward")
  78. (user-mail-address . "chris@chrishayward.xyz")
  79. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  80. (smtpmail-smtp-service . 587)
  81. (smtpmail-stream-type . starttls))))))
  82. #+end_src
  83. ** Keybinding
  84. Create a keybinding to open the mail dashboard with =SPC m=.
  85. #+begin_src emacs-lisp
  86. (dotfiles/leader
  87. "m" '(mu4e :which-key "Mail"))
  88. #+end_src
  89. ** Desktop notifications
  90. Receive notifications for incoming mail via the *mu4e-alert*[fn:5] package.
  91. #+begin_src emacs-lisp
  92. (use-package mu4e-alert
  93. :after mu4e
  94. :custom (mu4e-alert-set-default-style 'libnotify)
  95. :config (mu4e-alert-enable-notifications)
  96. (mu4e-alert-enable-mode-line-display))
  97. #+end_src
  98. * Resources
  99. [fn:1] https://codewith.mu/en/download
  100. [fn:2] https://emacswiki.org/emacs/mu4e
  101. [fn:3] https://isync.sourceforge.io
  102. [fn:4] mailto:chris@chrishayward.xyz
  103. [fn:5] https://github.com/iqbalansari/mu4e-alert