Skip to content

Instantly share code, notes, and snippets.

@ckhung
Last active December 17, 2024 07:40
Show Gist options
  • Save ckhung/b6c05ea495e8d05b1a7191903222b2b9 to your computer and use it in GitHub Desktop.
Save ckhung/b6c05ea495e8d05b1a7191903222b2b9 to your computer and use it in GitHub Desktop.
mbsync 與 msmtp 的設定檔 + mutt/ 目錄底下的四個設定檔
# ~/.mbsyncrc
# modified from https://www.cosroe.com/2024/05/neomutt-isync.html
# Global defaults that apply to all channels / accounts / stores
# Create in both places
Create Both
# Do not remove if missing in one place
Remove None
# Permanently delete those messages marked for deletion
Expunge Both
# Synchronise everything
Sync All
SyncState *
CopyArrivalDate yes
MaxMessages 0
# o365 @ cyut
IMAPAccount o365
Host outlook.office365.com
Port 993
AuthMechs XOAUTH2
User t199dddd@o365.cyut.edu.tw
PassCmd "mutt_oauth2.py --encryption-pipe cat --decryption-pipe cat ~/私密目錄/azure-token.json"
SSLType IMAPS
IMAPStore o365-remote
Account o365
MaildirStore o365-local
SubFolders Verbatim
Path ~/Maildir/o365/
Inbox ~/Maildir/o365/INBOX
Channel o365
Far :o365-remote:
Near :o365-local:
Patterns *
# gmail
IMAPAccount gmail
Host imap.gmail.com
Port 993
AuthMechs XOAUTH2
User 貴哥@gmail.com
PassCmd "mutt_oauth2.py --encryption-pipe cat --decryption-pipe cat ~/私密目錄/google-token.json"
SSLType IMAPS
IMAPStore gmail-remote
Account gmail
MaildirStore gmail-local
SubFolders Verbatim
Path ~/Maildir/gmail/
Inbox ~/Maildir/gmail/INBOX
Channel gmail
Far :gmail-remote:
Near :gmail-local:
Patterns * "![Gmail]/&kc2JgZD1TvY-" "![Gmail]/&UWiQ6JD1TvY-" "![Gmail]/&V4NXPmh2-" "![Gmail]/&V4NXPpD1TvY-" "![Gmail]/&XfJSoGYfhl8-"
# posteo
IMAPAccount posteo
Host posteo.de
Port 993
AuthMechs LOGIN
User ckhung@posteo.net
PassCmd "cat ~/私密目錄/posteo.txt"
SSLType IMAPS
IMAPStore posteo-remote
Account posteo
MaildirStore posteo-local
Path ~/Maildir/posteo/
Inbox ~/Maildir/posteo/INBOX
Channel posteo
Far :posteo-remote:
Near :posteo-local:
Patterns *
defaults
logfile ~/log/msmtp.log
auth on
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account o365
host smtp-mail.outlook.com
auth xoauth2
user t199dddd@o365.cyut.edu.tw
from ckhung@o365.cyut.edu.tw
passwordeval "mutt_oauth2.py --encryption-pipe cat --decryption-pipe cat ~/私密目錄/azure-token.json"
account gmail
host smtp.gmail.com
auth xoauth2
user 貴哥@gmail.com
from 貴哥@gmail.com
passwordeval "mutt_oauth2.py --encryption-pipe cat --decryption-pipe cat ~/私密目錄/google-token.json"
account posteo
host posteo.de
auth plain
user 貴哥@posteo.net
from 貴哥@posteo.net
passwordeval "cat ~/私密目錄/posteo.txt"
account default : posteo
set folder = ~/Mail/gmail
unmailboxes *
mailboxes ` ls ~/Mail/gmail/ | sed 's/^/+/' | tr '\n' ' ' `
set spoolfile = ~/Mail/gmail/INBOX
set postponed = +草稿
set record = +寄件備份
set sendmail = "msmtp -a gmail"
set from = "貴哥@gmail.com"
# basics: https://wiki.archlinux.org/title/Mutt
# multiple accounts: https://gist.github.com/miguelmota/9456162
# pine key bindings: https://github.com/neomutt/neomutt/issues/4457#issuecomment-2509634297
set sidebar_format = "%B%<F? [%F]>%* %<N?%N/>%S"
set mail_check_stats
set realname = "Greg Chao-Kuei Hung 洪朝貴"
set edit_headers
set signature ="~/.mutt/signature.txt"
folder-hook ~/Mail/cyut 'source ~/.mutt/cyut.acc'
folder-hook ~/Mail/gmail 'source ~/.mutt/gmail.acc'
folder-hook ~/Mail/posteo 'source ~/.mutt/posteo.acc'
# source ~/.mutt/posteo.acc # 預設要開哪個帳號?
macro index <f3> '<sync-mailbox><enter-command>source ~/.mutt/cyut<enter><change-folder>!<enter>'
macro index <f4> '<sync-mailbox><enter-command>source ~/.mutt/gmail<enter><change-folder>!<enter>'
macro index <f5> '<sync-mailbox><enter-command>source ~/.mutt/posteo<enter><change-folder>!<enter>'
# bind index,pager <Tab> sidebar-toggle-visible
bind pager <left> exit
bind pager <right> view-attachments
bind pager <up> previous-line
bind pager <down> next-line
bind pager p previous-entry
bind pager n next-entry
bind pager q quit
macro index <left> c?
bind index <right> display-message
bind index <up> previous-entry
bind index <down> next-entry
bind index x sync-mailbox
bind index ' ' next-page
bind generic <left> exit
bind generic <right> select-entry
macro generic q "<exit>q"
set folder = ~/Mail/o365
unmailboxes *
mailboxes ` ls ~/Mail/o365/ | sed 's/^/+/' | tr '\n' ' ' `
set spoolfile = ~/Mail/o365/INBOX
set postponed = +草稿
set record = +寄件備份
set sendmail = "msmtp -a cyut"
set from = "ckhung@o365.cyut.edu.tw"
my_hdr Reply-to: ckhung@cyut.edu.tw
set folder = ~/Mail/posteo
unmailboxes *
mailboxes ` ls ~/Mail/posteo/ | sed 's/^/+/' | tr '\n' ' ' `
set spoolfile = ~/Mail/posteo/INBOX
set postponed = +Drafts
set record = +Sent
set sendmail = "msmtp -a posteo"
set from = "ckhung@posteo.net"
my_hdr Reply-to: ckhung@cyut.edu.tw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment