Update all mail related configs

1. Use app password for gmail accounts
2. Add nilenso account to mutt, imapfilter, mbsync, msmtp

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-01-06 10:55:00 +05:30
parent f4ced7432d
commit ae310a18f7
8 changed files with 96 additions and 51 deletions

View File

@ -6,37 +6,41 @@ function main()
ssl = 'tls1',
}
-- Make sure the account is configured properly
sanchayan.INBOX:check_status()
-- sanchayan['[Gmail]/Trash']:check_status()
-- sanchayan['[Gmail]/Spam']:check_status()
-- Get all mail from INBOX
mails = sanchayan.INBOX:select_all()
-- Move mailing lists from INBOX to correct folders
move_mailing_lists(sanchayan, mails)
-- Get all mail from Sent Mail
mails = sanchayan.Sent:select_all()
-- Move mailing lists from Sent mail to correct folders
move_mailing_lists(sanchayan, mails)
-- Get all mail from trash
mails = sanchayan['[Gmail]/Trash']:select_all()
imap_trash = sanchayan['Trash']:select_all()
-- Move mailing lists from trash to correct folders
move_to_gmail_trash(sanchayan, imap_trash, '[Gmail]/Trash')
delete_from_trash(sanchayan, mails)
-- Get all mail from spam
mails = sanchayan['[Gmail]/Spam']:select_all()
-- Move mailing lists from spam to correct folders
move_mailing_lists(sanchayan, mails)
local nilenso = IMAP {
server = 'imap.gmail.com',
username = 'sanchayan@nilenso.systems',
password = get_pwd_nilenso(),
ssl = 'tls1',
}
nilenso.INBOX:check_status()
-- nilenso['[Gmail]/Trash']:check_status()
-- nilenso['[Gmail]/Spam']:check_status()
mails = nilenso.INBOX:select_all()
move_mailing_lists(nilenso, mails)
mails = nilenso.Sent:select_all()
move_mailing_lists(nilenso, mails)
mails = nilenso['[Gmail]/Trash']:select_all()
imap_trash = nilenso['Trash']:select_all()
move_to_gmail_trash(nilenso, imap_trash, '[Gmail]/Trash')
delete_from_trash(nilenso, mails)
mails = nilenso['[Gmail]/Spam']:select_all()
move_mailing_lists(nilenso, mails)
end
function move_mailing_lists(account, mails)
@ -125,4 +129,12 @@ function get_pwd_sanchayan()
return pass;
end
function get_pwd_nilenso()
local cmd = "gpg2 --use-agent --quiet --batch --decrypt ~/.nilenso.gpg"
local fd = io.popen(cmd, 'r')
pass = fd:read("*a")
fd:close()
return pass;
end
main() -- Call the main function

View File

@ -1,13 +1,33 @@
Create Slave
Expunge Both
SyncState *
IMAPAccount nilenso
Host imap.gmail.com
Port 993
User sanchayan@nilenso.systems
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.nilenso.gpg"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore nilenso-remote
Account nilenso
MaildirStore nilenso-local
SubFolders Verbatim
Path "~/Gmail/nilenso/"
Inbox "~/Gmail/nilenso/Inbox"
Channel nilenso
Master :nilenso-remote:
Slave :nilenso-local:
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
IMAPAccount gmail
# Address to connect to
Host imap.gmail.com
User maitysanchayan@gmail.com
# To store the password in an encrypted file use PassCmd instead of Pass
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.sanchayan.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
IMAPStore gmail-remote
@ -15,18 +35,10 @@ Account gmail
MaildirStore gmail-local
Subfolders Verbatim
# The trailing "/" is important
Path ~/Gmail/
Inbox ~/Gmail/Inbox
Path "~/Gmail/sanchayan/"
Inbox "~/Gmail/sanchayan/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 *

View File

@ -13,5 +13,11 @@ from maitysanchayan@gmail.com
user maitysanchayan@gmail.com
passwordeval "gpg2 --use-agent --batch --quiet --no-greeting --no-tty --for-your-eyes-only --homedir /home/core/.gnupg --decrypt ~/.sanchayan.gpg"
account nilenso
host smtp.gmail.com
from sanchayan@nilenso.systems
user sanchayan@nilenso.systems
passwordeval "gpg2 --use-agent --batch --quiet --no-greeting --no-tty --for-your-eyes-only --homedir /home/core/.gnupg --decrypt ~/.nilenso.gpg"
# Set a default account
account default : Sanchayan

View File

@ -0,0 +1,15 @@
set from = "sanchayan@nilenso.systems"
set sendmail = "/usr/bin/msmtp -a nilenso"
set mbox = "+Archive"
set postponed = "+drafts"
set record = "+Sent"
color status green default
macro index D \
"<save-message>+nilenso/Trash<enter>" \
"move message to the trash"
macro index S \
"<save-message>+nilenso/Spam<enter>" \
"mark message as spam"

View File

@ -7,9 +7,9 @@ set record = "+Sent"
color status green default
macro index D \
"<save-message>+Trash<enter>" \
"<save-message>+sanchayan/Trash<enter>" \
"move message to the trash"
macro index S \
"<save-message>+Spam<enter>" \
"<save-message>+sanchayan/Spam<enter>" \
"mark message as spam"

View File

@ -1,14 +1,15 @@
#!/bin/bash
imapfilter -c /home/core/.imapfilter/config.lua
mbsync -Va
imapfilter -c ~/.imapfilter/config.lua
mbsync -a
notmuch new
export DISPLAY=:0
let inbox=`ls /home/core/Mail/Inbox/new/|wc -l`
let inbox=`ls /home/core/Gmail/sanchayan/Inbox/new/|wc -l`
let nilenso_inbox=`ls /home/core/Gmail/nilenso/Inbox/new/|wc -l`
if (("$inbox" > 0)); then
sudo -u core DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "You have
$inbox new mails in Inbox"
if (("$inbox" > 0) || ("$nilenso_inbox" > 0)); then
sudo -u core DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "You have $inbox new mails in inbox"
sudo -u core DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "You have $nilenso_inbox new mails in Nilenso inbox"
fi

View File

@ -1,11 +1,13 @@
set mbox_type = Maildir
set spoolfile = "+Inbox"
set folder = ~/Gmail
set spoolfile = +/sanchayan/Inbox
set header_cache=~/Gmail/mutt_cache/ # a much faster opening of mailboxes...
source ~/.mutt/accounts/sanchayan
source ~/.mutt/accounts/nilenso
folder-hook Sanchayan/* source ~/.mutt/accounts/sanchayan
#folder-hook Victor/* source ~/.mutt/accounts/victor
folder-hook sanchayan/* source ~/.mutt/accounts/sanchayan
folder-hook nilenso/* source ~/.mutt/accounts/nilenso
set mail_check = 0
set envelope_from
@ -73,7 +75,4 @@ macro index L "<enter-command>unset wait_key<enter><shell-escape>read -p 'notmuc
# 'a' shows all messages again (supersedes default <alias> binding)
macro index a "<limit>all\n" "show all messages (undo limit)"
set header_cache=~/Gmail/mutt_cache/ # a much faster opening of mailboxes...
macro index D "<save-message>+/Trash<enter>" "Move message to the trash"
# macro index D "<save-message>+/Trash<enter>" "Move message to the trash"

View File

@ -11,7 +11,7 @@
# configured here named ".notmuch".
#
[database]
path=/home/core/Mail
path=/home/core/Gmail
# User configuration
#
@ -30,8 +30,8 @@ path=/home/core/Mail
#
[user]
name=Sanchayan Maity
primary_email=maitysanchayan@gmail.com
other_email=victorascroft@gmail.com;
primary_email=sanchayan@nilenso.systems
other_email=maitysanchayan@gmail.com;
# Configuration for "notmuch new"
#