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.

150 lines
4.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Mu4e
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle mu4e.el :comments org
  5. #+PROPERTY: header-args:shell :tangle no
  6. #+PROPERTY: header-args :results silent :eval no-export :comments org
  7. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  8. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  9. Plain-text email inside of Emacs.
  10. * Setup
  11. Make sure the following dependencies are installed on your system before loading the module. I would recommend against using any distributions pre-packaged version of ~mu4e~[fn:1], and instead build it yourself which I detail in this post[fn:2]:
  12. #+begin_src shell
  13. RUN apt install -y isync libgmime-3.0-dev libxapian-dev
  14. #+end_src
  15. ** Setting up mbsync
  16. :PROPERTIES:
  17. :header-args: :tangle ../config/mbsyncrc :comments org
  18. :END:
  19. The program that actually synchronizes the emails with the server is ~mbsync~[fn:3]. Create the configuration file, this is for my personal mail server[fn:4], which I host myself, so make sure you write your own.
  20. #+begin_src conf
  21. IMAPStore xyz-remote
  22. Host mail.chrishayward.xyz
  23. User chris@chrishayward.xyz
  24. PassCmd "pass chrishayward.xyz/chris"
  25. SSLType IMAPS
  26. MaildirStore xyz-local
  27. Path ~/.cache/mail/
  28. Inbox ~/.cache/mail/inbox
  29. SubFolders Verbatim
  30. Channel xyz
  31. Master :xyz-remote:
  32. Slave :xyz-local:
  33. Patterns * !Archives
  34. Create Both
  35. Expunge Both
  36. SyncState *
  37. #+end_src
  38. ** Create symbolic links
  39. 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.
  40. #+begin_src emacs-lisp
  41. (dotfiles/symlink "~/.emacs.d/config/mbsyncrc"
  42. "~/.mbsyncrc")
  43. #+end_src
  44. This repository also contains my personal encrypted auth info, this is required by ~mbsync~[fn:3] to sign all of the outbound messages.
  45. #+begin_src emacs-lisp
  46. (dotfiles/symlink "~/.emacs.d/config/authinfo.gpg"
  47. "~/.authinfo.gpg")
  48. #+end_src
  49. ** First time indexing
  50. Before you can use ~mu4e~[fn:1] inside of Emacs, you need to synchronize the mail database, and index it using ~mu~[fn:5], the library used by ~mu4e~[fn:1] under the hood. Execute these commands in your terminal before loading the module, after that you can do everything inside of Emacs:
  51. #+begin_src shell
  52. RUN mbsync -a
  53. RUN mu init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz"
  54. RUN mu index
  55. #+end_src
  56. * Config
  57. After syncing and indexing, the mail is ready for Emacs. Include ~mu4e~[fn:1] in the configuration by adding the custom built version to the load path, and configure the mail account.
  58. + Update every 5 minutes
  59. + Configure mail account(s)
  60. + Scale text for all devices
  61. + Sign outbound mail with GPG key
  62. #+begin_src emacs-lisp
  63. (use-package mu4e
  64. :load-path "~/.local/source/mu/mu4e/"
  65. :custom (mu4e-maildir "~/.cache/mail")
  66. (mu4e-update-interval (* 5 60))
  67. (mu4e-get-mail-command "mbsync -a")
  68. (mu4e-compose-format-flowed t)
  69. (mu4e-change-filenames-when-moving t)
  70. (message-send-mail-function 'smtpmail-send-it)
  71. (mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  72. (mu4e-compose-signature (concat "Chris Hayward\n"
  73. "https://chrishayward.xyz\n"))
  74. :config
  75. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  76. (setq mu4e-contexts
  77. (list
  78. ;; Main
  79. ;; chris@chrishayward.xyz
  80. (make-mu4e-context
  81. :name "Main"
  82. :match-func
  83. (lambda (msg)
  84. (when msg
  85. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  86. :vars
  87. '((user-full-name . "Christopher James Hayward")
  88. (user-mail-address . "chris@chrishayward.xyz")
  89. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  90. (smtpmail-smtp-service . 587)
  91. (smtpmail-stream-type . starttls))))))
  92. #+end_src
  93. ** Desktop notifications
  94. Receive desktop notifications when new mail arrives with the ~mu4e-alert~[fn:6] package.
  95. #+begin_src emacs-lisp
  96. (use-package mu4e-alert
  97. :after mu4e
  98. :custom (mu4e-alert-set-default-style 'libnotify)
  99. :config (mu4e-alert-enable-notifications)
  100. (mu4e-alert-enable-mode-line-display))
  101. #+end_src
  102. * Shortcuts
  103. Open the ~mu4e~[fn:1] dashboard with =SPC m=.
  104. #+begin_src emacs-lisp
  105. (dotfiles/leader
  106. "m" '(mu4e :which-key "Mu4e"))
  107. #+end_src
  108. * Footnotes
  109. [fn:1] https://emacswiki.org/emacs/mu4e
  110. [fn:2] https://chrishayward.xyz/posts/installing-mu-mu4e-from-source/
  111. [fn:3] https://isync.sourceforge.io
  112. [fn:4] mailto:chris@chrishayward.xyz
  113. [fn:5] https://codewith.mu/en/download
  114. [fn:6] https://github.com/iqbalansari/mu4e-alert