User Tools

Site Tools


software:cli:mail:sync

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
software:cli:mail:sync [2021/12/29 21:09] – ↷ Page moved from mail:sync to software:cli:mail:sync warnaudsoftware:cli:mail:sync [2021/12/29 21:09] (current) – ↷ Links adapted because of a move operation warnaud
Line 1: Line 1:
 +====== Introduction ======
 +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 :)
 +====== Pre-requisite ======
 +You need to enable IMAP connection on your gmail account: Setttings(button)/Settings/Forwarding and POP/IMAP then "enable IMAP"
 +====== Install ======
 +You need to install isync
 +====== Configuration ======
 +I use to store mails in the following folder hierarchy:
 +<code bash>
 +/home/warnaud/Mails/
 +└── superaddress1@gmail.com
 +└── superaddress2@gmail.com
 +└── superaddress3@gmail.com
 +└── …
 +</code>
 +This way all my mails from all my accounts will be synchronized in one place :) thus easily browsable/searchable.
 +for configuration:
 +===== .mbsyncrc =====
 +The configuration file that will contains all nice email address to retrieve/sync
  
 +<code bash>
 +IMAPAccount gmail
 +# Address to connect to
 +Host imap.gmail.com
 +User superaddress1@gmail.com
 +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
 +SSLType IMAPS
 +# 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/imap.gmail.com.pem
 +#CertificateFile ~/.cert/Equifax_Secure_CA.pem
 +
 +IMAPStore gmail-remote
 +Account gmail
 +
 +MaildirStore gmail-local
 +# The trailing "/" is important
 +Path ~/Mails/superaddress1@gmail.com/
 +Inbox ~/Mails/superaddress1@gmail.com/Inbox
 +
 +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 *
 +</code>
 +====== Sync ======
 +now we can test if it works:
 +<code bash> 
 +mbsync gmail
 +</code>
 +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:[[software:cli:mail:filter]]
 +Once all this is done you can switch to [[software:cli:mail:mutt|Mutt/neomutt]]
 +====== Reference ======
 +  * https://wiki.archlinux.org/index.php/Isync