From ccdc4e0c2f85ad11b81c0d5260abd105754c2bd0 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Tue, 13 Dec 2016 11:10:38 -0500 Subject: [PATCH] Add my GNU email Use getmail to fetch my GNU mail over pop3. After stowing getmail config, run it like this the first time: getmail --store-password-in-gnome-keyring to save the password in the Default gnome keyring. Then, proceed to run it without arguments, and/or enable and start the systemd timer for auto-syncing. Requires: getmail gnome-keyring python2-gnome-keyring --- .gitignore | 3 ++ getmail/.config/systemd/user/getmail.service | 8 ++++ getmail/.config/systemd/user/getmail.timer | 10 +++++ getmail/.getmail/getmailrc | 14 +++++++ isync/.config/systemd/user/mbsync.service | 2 +- isync/.config/systemd/user/mbsync.timer | 4 +- spacemacs/.emacs.d/private/aminb/packages.el | 43 +++++++++++++++----- spacemacs/.spacemacs | 1 + 8 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 getmail/.config/systemd/user/getmail.service create mode 100644 getmail/.config/systemd/user/getmail.timer create mode 100644 getmail/.getmail/getmailrc diff --git a/.gitignore b/.gitignore index bdbd894..5ff3d24 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ ranger/*/*/tagged # ncmpcpp ncmpcpp/*/error.log + +# getmail oldmail file +oldmail-* diff --git a/getmail/.config/systemd/user/getmail.service b/getmail/.config/systemd/user/getmail.service new file mode 100644 index 0000000..4e91ef3 --- /dev/null +++ b/getmail/.config/systemd/user/getmail.service @@ -0,0 +1,8 @@ +[Unit] +Description=getmail service + +[Service] +Type=oneshot +ExecStart=/usr/bin/getmail +StandardOutput=syslog +StandardError=syslog diff --git a/getmail/.config/systemd/user/getmail.timer b/getmail/.config/systemd/user/getmail.timer new file mode 100644 index 0000000..64036a8 --- /dev/null +++ b/getmail/.config/systemd/user/getmail.timer @@ -0,0 +1,10 @@ +[Unit] +Description=getmail timer + +[Timer] +OnCalendar=0/1:00:00 +Persistent=true +Unit=getmail.service + +[Install] +WantedBy=timers.target diff --git a/getmail/.getmail/getmailrc b/getmail/.getmail/getmailrc new file mode 100644 index 0000000..11e4ce4 --- /dev/null +++ b/getmail/.getmail/getmailrc @@ -0,0 +1,14 @@ +[retriever] +type = SimplePOP3SSLRetriever +server = fencepost.gnu.org +username = aminb +port = 995 +use_apop = True + +[destination] +type = Maildir +path = ~/mail/gnu/Inbox/ + +[options] +read_all = False +# delete = True diff --git a/isync/.config/systemd/user/mbsync.service b/isync/.config/systemd/user/mbsync.service index 7fc2821..e203ca6 100644 --- a/isync/.config/systemd/user/mbsync.service +++ b/isync/.config/systemd/user/mbsync.service @@ -1,5 +1,5 @@ [Unit] -Description=Mailbox synchronization service +Description=mbsync service [Service] Type=oneshot diff --git a/isync/.config/systemd/user/mbsync.timer b/isync/.config/systemd/user/mbsync.timer index 7c3c751..bbb8115 100644 --- a/isync/.config/systemd/user/mbsync.timer +++ b/isync/.config/systemd/user/mbsync.timer @@ -1,8 +1,8 @@ [Unit] -Description=Mailbox synchronization timer +Description=mbsync timer [Timer] -OnCalendar=*:0/5 +OnCalendar=*:0/15 Persistent=true Unit=mbsync.service diff --git a/spacemacs/.emacs.d/private/aminb/packages.el b/spacemacs/.emacs.d/private/aminb/packages.el index 01e9578..8e6e1ec 100644 --- a/spacemacs/.emacs.d/private/aminb/packages.el +++ b/spacemacs/.emacs.d/private/aminb/packages.el @@ -140,13 +140,14 @@ erc-modified-channels-alist. Should be executed on window change." ))) (defun aminb/post-init-mu4e () + (setq maildir "~/mail") (use-package mu4e :defer t :config (progn - (setq mu4e-maildir "~/mail" - mu4e-get-mail-command "mbsync -a" ;; or fetchmail, or ... - mu4e-update-interval 300 ;; update every 5 minutes + (setq mu4e-maildir maildir + mu4e-get-mail-command "mbsync -a" + mu4e-update-interval nil mu4e-view-show-addresses t mu4e-headers-include-related t mu4e-enable-notifications t @@ -156,8 +157,7 @@ erc-modified-channels-alist. Should be executed on window change." (concat "Amin Bandali\n" "\n") - ;; don't keep message buffers around - message-kill-buffer-on-exit t + message-kill-buffer-on-exit t ; don't keep message buffers around mu4e-attachment-dir "~/dls" mu4e-sent-folder "/amin/Sent" mu4e-drafts-folder "/amin/Drafts" @@ -167,8 +167,8 @@ erc-modified-channels-alist. Should be executed on window change." mu4e-context-policy 'pick-first mu4e-contexts (list (make-mu4e-context - :name "amin" - :enter-func (lambda () (mu4e-message "Switch to the amin context")) + :name "Personal" + :enter-func (lambda () (mu4e-message "Switch to the Personal context")) :match-func (lambda (msg) (when msg (s-prefix? "/amin/" (mu4e-message-field msg :maildir)))) @@ -182,8 +182,8 @@ erc-modified-channels-alist. Should be executed on window change." (smtpmail-stream-type . starttls) (smtpmail-smtp-service . 587))) (make-mu4e-context - :name "gmail" - :enter-func (lambda () (mu4e-message "Switch to the gmail context")) + :name "BB" + :enter-func (lambda () (mu4e-message "Switch to the BB context")) :match-func (lambda (msg) (when msg (s-prefix? "/gmail/" (mu4e-message-field msg :maildir)))) @@ -192,10 +192,27 @@ erc-modified-channels-alist. Should be executed on window change." (mu4e-drafts-folder . "/gmail/Drafts") (mu4e-trash-folder . "/gmail/Trash") (mu4e-sent-messages-behavior . delete) + (mu4e-compose-signature . nil) (smtpmail-default-smtp-server . "smtp.gmail.com") (smtpmail-smtp-server . "smtp.gmail.com") (smtpmail-stream-type . starttls) - (smtpmail-smtp-service . 587))))) + (smtpmail-smtp-service . 587))) + (make-mu4e-context + :name "GNU" + :enter-func (lambda () (mu4e-message "Switch to the GNU context")) + :match-func (lambda (msg) + (when msg + (s-prefix? "/gnu/" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "aminb@gnu.org") + (mu4e-sent-folder . "/gnu/Sent") + (mu4e-drafts-folder . "/gnu/Drafts") + (mu4e-trash-folder . "/gnu/Trash") + (mu4e-get-mail-command . "getmail") + (mu4e-sent-messages-behavior . sent) + (smtpmail-default-smtp-server . "fencepost.gnu.org") + (smtpmail-smtp-server . "fencepost.gnu.org") + (smtpmail-stream-type . starttls) + (smtpmail-smtp-service . 587))))) (with-eval-after-load 'mu4e-alert ;; Enable Desktop notifications (mu4e-alert-set-default-style 'notifications)))) @@ -222,6 +239,12 @@ erc-modified-channels-alist. Should be executed on window change." (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)) ) + ;; Exclude the files in maildir from recents + (use-package recentf + :defer t + :config + (add-to-list 'recentf-exclude (expand-file-name maildir))) + (spacemacs/set-leader-keys "am" 'mu4e) ) diff --git a/spacemacs/.spacemacs b/spacemacs/.spacemacs index 4c93f11..3a27d81 100644 --- a/spacemacs/.spacemacs +++ b/spacemacs/.spacemacs @@ -326,6 +326,7 @@ you should place your code here." ;; (setq magit-commit-arguments '("--signoff" ;; "--gpg-sign=4E05246AB0BF7FFB")) + ;; Persistent undo across restarts (setq undo-tree-auto-save-history t undo-tree-history-directory-alist `(("." . ,(concat spacemacs-cache-directory "undo")))) -- 2.20.1