IMAPAccount gmail-mailid Host imap.gmail.com User mailid@gmail.com PassCmd "gpg --for-your-eyes-only --no-tty -qd ~/.authinfo.gpg | grep imap.gmail.com | grep mailid | awk '{ for (i=1; i<NF; i++) { if ($i == \"password\") print $(i+1) } }'" # 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-mailid-remote Account gmail-mailid MaildirStore gmail-mailid-local Subfolders Verbatim # The trailing "/" is important Path ~/.mail/gmail/mailid/ Inbox ~/.mail/gmail/mailid/inbox Channel gmail-mailid-default Master :gmail-mailid-remote: Slave :gmail-mailid-local:Inbox Channel gmail-mailid-sent Master :gmail-mailid-remote: "[Gmail]/Sent Mail" slave :gmail-mailid-local:Sent Channel gmail-mailid-trash Master :gmail-mailid-remote: "[Gmail]/Trash" slave :gmail-mailid-local:Trash Channel gmail-mailid-archive Master :gmail-mailid-remote: "[Gmail]/All Mail" slave :gmail-mailid-local:All Channel gmail-mailid-junk Master :gmail-mailid-remote: "[Gmail]/Spam" slave :gmail-mailid-local:Junk # Automatically create missing mailboxes, both locally and on the server Create Both # Automatically delete messages on either side if they are found deleted on the other Expunge Both # Save the synchronization state files in the relevant directory SyncState *