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.

157 lines
4.3 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: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. #+ATTR_ORG: :width 420px
  10. #+ATTR_HTML: :width 420px
  11. #+ATTR_LATEX: :width 420px
  12. [[../docs/images/2021-02-13-example-mu4e.gif]]
  13. 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.
  14. * Sync
  15. :PROPERTIES:
  16. :header-args: :tangle ../config/mbsyncrc :comments org
  17. :END:
  18. This is the *mbsyncrc*[fn:3] file I use to synchronize my local mail with my server.
  19. #+begin_src conf
  20. IMAPStore xyz-remote
  21. Host mail.chrishayward.xyz
  22. User chris@chrishayward.xyz
  23. PassCmd "pass chrishayward.xyz/chris"
  24. SSLType IMAPS
  25. MaildirStore xyz-local
  26. Path ~/.cache/mail/
  27. Inbox ~/.cache/mail/inbox
  28. SubFolders Verbatim
  29. Channel xyz
  30. Master :xyz-remote:
  31. Slave :xyz-local:
  32. Patterns * !Archives
  33. Create Both
  34. Expunge Both
  35. SyncState *
  36. #+end_src
  37. ** Create symbolic link
  38. 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.
  39. #+begin_src emacs-lisp
  40. (dotfiles/symlink "~/.emacs.d/config/mbsyncrc"
  41. "~/.mbsyncrc")
  42. #+end_src
  43. This repository also contains my personal encrypted auth info.
  44. #+begin_src emacs-lisp
  45. (dotfiles/symlink "~/.emacs.d/config/authinfo.gpg"
  46. "~/.authinfo.gpg")
  47. #+end_src
  48. ** Installing the software
  49. Download *mbsync*[fn:3] as part of the ~isync~ package on Ubuntu/Debian.
  50. #+begin_src shell
  51. sudo apt install -y isync
  52. #+end_src
  53. *Mu4e*[fn:2] is packaged for Ubuntu/Debian, but has a few dependencies to build for Emacs.
  54. #+begin_src shell
  55. sudo apt install -y mu4e libgmime-3.0-dev libxapian-dev
  56. #+end_src
  57. * Indexing
  58. :PROPERTIES:
  59. :header-args: :tangle no
  60. :END:
  61. Once mail has been synchronized you need to index it using *mu*[fn:1].
  62. #+begin_src shell
  63. mbsync -a
  64. mu index --maildir="~/.cache/mail"
  65. #+end_src
  66. * Integration
  67. After syncing and indexing the mail is ready for Emacs. Download and install *mu4e*[fn:2] and configure the *mail account*[fn:3].
  68. + Update every 5 minutes
  69. + Scale text for all devices
  70. + Sign outbound mail with GPG key
  71. + Configure mail account(s)
  72. #+begin_src emacs-lisp
  73. (use-package mu4e
  74. :load-path "/usr/share/emacs/site-lisp/mu4e"
  75. :custom (mu4e-maildir "~/.cache/mail")
  76. (mu4e-update-interval (* 5 60))
  77. (mu4e-get-mail-command "mbsync -a")
  78. (mu4e-compose-format-flowed t)
  79. (mu4e-change-filenames-when-moving t)
  80. (message-send-mail-function 'smtpmail-send-it)
  81. (mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  82. (mu4e-compose-signature (concat "Chris Hayward\n"
  83. "https://chrishayward.xyz\n"))
  84. :config
  85. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  86. (setq mu4e-contexts
  87. (list
  88. ;; Main
  89. ;; chris@chrishayward.xyz
  90. (make-mu4e-context
  91. :name "Main"
  92. :match-func
  93. (lambda (msg)
  94. (when msg
  95. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  96. :vars
  97. '((user-full-name . "Christopher James Hayward")
  98. (user-mail-address . "chris@chrishayward.xyz")
  99. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  100. (smtpmail-smtp-service . 587)
  101. (smtpmail-stream-type . starttls))))))
  102. #+end_src
  103. ** Keybinding
  104. Create a keybinding to open the mail dashboard with =SPC m=.
  105. #+begin_src emacs-lisp
  106. (dotfiles/leader
  107. "m" '(mu4e :which-key "Mail"))
  108. #+end_src
  109. ** Desktop notifications
  110. Receive notifications for incoming mail via the *mu4e-alert*[fn:5] package.
  111. #+begin_src emacs-lisp
  112. (use-package mu4e-alert
  113. :after mu4e
  114. :custom (mu4e-alert-set-default-style 'libnotify)
  115. :config (mu4e-alert-enable-notifications)
  116. (mu4e-alert-enable-mode-line-display))
  117. #+end_src
  118. * Resources
  119. [fn:1] https://codewith.mu/en/download
  120. [fn:2] https://emacswiki.org/emacs/mu4e
  121. [fn:3] https://isync.sourceforge.io
  122. [fn:4] mailto:chris@chrishayward.xyz
  123. [fn:5] https://github.com/iqbalansari/mu4e-alert