Last active
March 21, 2025 23:35
-
-
Save MatthewZMD/39cc00260486d17450f7228a4f36891f to your computer and use it in GitHub Desktop.
.mbsyncrc Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gmail Example | |
# mbsyncrc based on | |
# http://www.ict4g.net/adolfo/notes/2014/12/27/EmacsIMAP.html | |
# ACCOUNT INFORMATION | |
IMAPAccount gmail | |
# Address to connect to | |
Host imap.gmail.com | |
User <EMAIL_HERE> | |
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.emacs.d/mu4e/.mbsyncpass-<EMAIL_HERE>.gpg" | |
AuthMechs LOGIN | |
SSLType IMAPS | |
SSLVersions TLSv1.3 | |
CertificateFile /etc/ssl/certs/ca-certificates.crt | |
# THEN WE SPECIFY THE LOCAL AND REMOTE STORAGE | |
# - THE REMOTE STORAGE IS WHERE WE GET THE MAIL FROM (E.G., THE | |
# SPECIFICATION OF AN IMAP ACCOUNT) | |
# - THE LOCAL STORAGE IS WHERE WE STORE THE EMAIL ON OUR COMPUTER | |
# REMOTE STORAGE (USE THE IMAP ACCOUNT SPECIFIED ABOVE) | |
IMAPStore gmail-remote | |
Account gmail | |
# LOCAL STORAGE (CREATE DIRECTORIES with mkdir -p ~/Maildir/gmail) | |
MaildirStore gmail-local | |
Path ~/Maildir/gmail/ | |
Inbox ~/Maildir/gmail/INBOX | |
# REQUIRED ONLY IF YOU WANT TO DOWNLOAD ALL SUBFOLDERS; SYNCING SLOWS DOWN | |
# SubFolders Verbatim | |
# CONNECTIONS SPECIFY LINKS BETWEEN REMOTE AND LOCAL FOLDERS | |
# | |
# CONNECTIONS ARE SPECIFIED USING PATTERNS, WHICH MATCH REMOTE MAIl | |
# FOLDERS. SOME COMMONLY USED PATTERS INCLUDE: | |
# | |
# 1 "*" TO MATCH EVERYTHING | |
# 2 "!DIR" TO EXCLUDE "DIR" | |
# 3 "DIR" TO MATCH DIR | |
Channel gmail-inbox | |
Far :gmail-remote: | |
Near :gmail-local: | |
Patterns "INBOX" | |
Create Both | |
Expunge Both | |
SyncState * | |
Channel gmail-sent | |
Far :gmail-remote:"[Gmail]/Sent Mail" | |
Near :gmail-local:"Sent Mail" | |
Create Both | |
Expunge Both | |
SyncState * | |
Channel gmail-all | |
Far :gmail-remote:"[Gmail]/All Mail" | |
Near :gmail-local:"All Mail" | |
Create Both | |
Expunge Both | |
SyncState * | |
Channel gmail-starred | |
Far :gmail-remote:"[Gmail]/Starred" | |
Near :gmail-local:"Starred" | |
Create Both | |
Expunge Both | |
SyncState * | |
Channel gmail-trash | |
Far :gmail-remote:"[Gmail]/Trash" | |
Near :gmail-local:"Trash" | |
Create Both | |
Expunge Both | |
SyncState * | |
# GROUPS PUT TOGETHER CHANNELS, SO THAT WE CAN INVOKE | |
# MBSYNC ON A GROUP TO SYNC ALL CHANNELS | |
# | |
# FOR INSTANCE: "mbsync gmail" GETS MAIL FROM | |
# "gmail-inbox", "gmail-sent", and "gmail-trash" | |
# | |
Group gmail | |
Channel gmail-inbox | |
Channel gmail-sent | |
Channel gmail-trash | |
Channel gmail-all | |
Channel gmail-starred | |
# Posteo Example | |
# ACCOUNT INFORMATION | |
IMAPAccount posteo | |
# Address to connect to | |
Host posteo.de | |
User <EMAIL> | |
PassCmd "emacs --batch --eval \"(require 'auth-source)\" --eval \"(let ((pw (auth-source-pick-first-password :host \\\"posteo.de\\\" :user \\\"<EMAIL>\\\"))) (princ pw))\"" | |
AuthMechs LOGIN | |
SSLType IMAPS | |
SSLVersions TLSv1.3 | |
# THEN WE SPECIFY THE LOCAL AND REMOTE STORAGE | |
# - THE REMOTE STORAGE IS WHERE WE GET THE MAIL FROM (E.G., THE | |
# SPECIFICATION OF AN IMAP ACCOUNT) | |
# - THE LOCAL STORAGE IS WHERE WE STORE THE EMAIL ON OUR COMPUTER | |
# REMOTE STORAGE (USE THE IMAP ACCOUNT SPECIFIED ABOVE) | |
IMAPStore posteo-remote | |
Account posteo | |
# LOCAL STORAGE (CREATE DIRECTORIES with mkdir -p ~/Maildir/posteo) | |
MaildirStore posteo-local | |
Path ~/Maildir/posteo/ | |
Inbox ~/Maildir/posteo/INBOX | |
# REQUIRED ONLY IF YOU WANT TO DOWNLOAD ALL SUBFOLDERS; SYNCING SLOWS DOWN | |
# SubFolders Verbatim | |
# CONNECTIONS SPECIFY LINKS BETWEEN REMOTE AND LOCAL FOLDERS | |
# | |
# CONNECTIONS ARE SPECIFIED USING PATTERNS, WHICH MATCH REMOTE MAIl | |
# FOLDERS. SOME COMMONLY USED PATTERS INCLUDE: | |
# | |
# 1 "*" TO MATCH EVERYTHING | |
# 2 "!DIR" TO EXCLUDE "DIR" | |
# 3 "DIR" TO MATCH DIR | |
Channel posteo-inbox | |
Far :posteo-remote: | |
Near :posteo-local: | |
Patterns "INBOX" | |
Create Both | |
Expunge Both | |
SyncState * | |
Channel posteo-sent | |
Far :posteo-remote:"Sent" | |
Near :posteo-local:"Sent" | |
Create Both | |
Expunge Both | |
SyncState * | |
Channel posteo-trash | |
Far :posteo-remote:"Trash" | |
Near :posteo-local:"Trash" | |
Create Both | |
Expunge Both | |
SyncState * | |
# GROUPS PUT TOGETHER CHANNELS, SO THAT WE CAN INVOKE | |
# MBSYNC ON A GROUP TO SYNC ALL CHANNELS | |
# | |
# FOR INSTANCE: "mbsync posteo" GETS MAIL FROM | |
# "posteo-inbox", "posteo-sent", and "posteo-trash" | |
# | |
Group posteo | |
Channel posteo-inbox | |
Channel posteo-sent | |
Channel posteo-trash |
Set SSLVersions
depending on the output of
openssl s_client -connect imap.gmail.com:993 -showcerts | grep Protocol
hi, I use mbsync -a
and have this error. (only INBOX sync success)
Error: channel gmail-sent: both far side [Gmail]/Sent Mail and near side Sent Mail cannot be opened.
do you have any advice?
thx
@idhowardgj94 I've never seen it before unfortunately. Try asking on https://github.com/gburd/isync
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you use the Gmail approach to
PassCmd
Change
<EMAIL_HERE>
to your actual Gmail username.Save your Gmail password at
~/.emacs.d/mu4e/.mbsyncpass-<EMAIL_HERE>
Encrypt it with
Delete the original plain password file for obvious security reasons.
If you use the Posteo approach to
PassCmd
Just set it in
.authinfo
or.authinfo.gpg
(encrypted)