User Tools

Site Tools



Tired of having mails everywhere and use different software/interface to access them and bloated email client, i will use command line software to retrieve/filter, compose/read& send emails with fast and powerfull CLI. First we need to retrieve emails, there are lots of software doing this. I choose isync as it works out of the box for Gmail accounts :)


You need to enable IMAP connection on your gmail account: Setttings(button)/Settings/Forwarding and POP/IMAP then “enable IMAP”


You need to install isync


I use to store mails in the following folder hierarchy:

└── …

This way all my mails from all my accounts will be synchronized in one place :) thus easily browsable/searchable. for configuration:


The configuration file that will contains all nice email address to retrieve/sync

IMAPAccount gmail
# Address to connect to
Pass YourSup3rP@ssw0rd
#To store the password in an encrypted file use PassCmd instead of Pass
# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
# Use SSL
# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.
CertificateFile /etc/ssl/certs/ca-certificates.crt
#CertificateFile ~/.cert/
#CertificateFile ~/.cert/Equifax_Secure_CA.pem
IMAPStore gmail-remote
Account gmail
MaildirStore gmail-local
# The trailing "/" is important
Path ~/Mails/
Inbox ~/Mails/
Channel gmail
Master :gmail-remote:
Slave :gmail-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
# Or include everything
#Patterns *
# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
SyncState *


now we can test if it works:

mbsync gmail

depending on the size of your mailbox you better go grab a coffee :) you can also, and I would recommend it, filter you email prior to sync:filter Once all this is done you can switch to Mutt/neomutt


software/cli/mail/sync.txt · Last modified: 2021/12/29 21:09 by warnaud