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.

142 lines
4.0 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. ** Create symbolic link
  37. 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.
  38. #+begin_src emacs-lisp
  39. (dotfiles/symlink "~/.emacs.d/config/mbsyncrc"
  40. "~/.mbsyncrc")
  41. #+end_src
  42. This repository also contains my personal encrypted auth info.
  43. #+begin_src emacs-lisp
  44. (dotfiles/symlink "~/.emacs.d/config/authinfo.gpg"
  45. "~/.authinfo.gpg")
  46. #+end_src
  47. * Indexing
  48. :PROPERTIES:
  49. :header-args: :tangle no
  50. :END:
  51. Once mail has been synchronized you need to index it using *mu*[fn:1].
  52. #+begin_src shell
  53. mbsync -a
  54. mu index --maildir="~/.cache/mail"
  55. #+end_src
  56. * Integration
  57. After syncing and indexing the mail is ready for Emacs. Download and install *mu4e*[fn:2] and configure the *mail account*[fn:3].
  58. + Update every 5 minutes
  59. + Scale text for all devices
  60. + Sign outbound mail with GPG key
  61. + Configure mail account(s)
  62. #+begin_src emacs-lisp
  63. (use-package mu4e
  64. :load-path "/usr/share/emacs/site-lisp/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. ** Keybinding
  94. Create a keybinding to open the mail dashboard with =SPC m=.
  95. #+begin_src emacs-lisp
  96. (dotfiles/leader
  97. "m" '(mu4e :which-key "Mail"))
  98. #+end_src
  99. ** Desktop notifications
  100. Receive notifications for incoming mail via the *mu4e-alert*[fn:5] package.
  101. #+begin_src emacs-lisp
  102. (use-package mu4e-alert
  103. :after mu4e
  104. :custom (mu4e-alert-set-default-style 'libnotify)
  105. :config (mu4e-alert-enable-notifications)
  106. (mu4e-alert-enable-mode-line-display))
  107. #+end_src
  108. * Resources
  109. [fn:1] https://codewith.mu/en/download
  110. [fn:2] https://emacswiki.org/emacs/mu4e
  111. [fn:3] https://isync.sourceforge.io
  112. [fn:4] mailto:chris@chrishayward.xyz
  113. [fn:5] https://github.com/iqbalansari/mu4e-alert