From 7b3eb9d69dd0e88553c903b7f63c7c0d1433bb09 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 9 May 2014 13:20:54 +0200 Subject: [PATCH] passeval --- msmtp | 1 + muttrc | 6 +++--- offlineimap.py | 11 +++++++++++ offlineimaprc | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 offlineimap.py diff --git a/msmtp b/msmtp index 3473efc..7225816 100644 --- a/msmtp +++ b/msmtp @@ -5,4 +5,5 @@ auth on tls on tls_certcheck off user mart@martlubbers.net +passwordeval gpg --quiet --batch --use-agent -d ~/passwd.gpg | grep -i mail | awk '{print $3}' from mart@martlubbers.net diff --git a/muttrc b/muttrc index ed9508f..8dba152 100644 --- a/muttrc +++ b/muttrc @@ -5,8 +5,8 @@ set envelope_from=yes set my_hdr="X-PGP-Key: http://www.martlubbers.net/mart@martlubbers.net.asc" # Receiving and sending email -set my_msmtp_pass=`gpg -d ~/passwd.gpg | grep -i mail | awk '{print $3}'` -set sendmail="/usr/local/bin/msmtp -C /home/mart/.mutt/msmtp --password=$my_msmtp_pass -f mart@martlubbers.net -a net" +set my_msmtp_pass=`gpg -d ~/passwd.gpg >> /dev/null` +set sendmail="msmtp -C /home/mart/.mutt/msmtp -f mart@martlubbers.net -a net" # Bindings index bind index gg first-entry @@ -21,7 +21,7 @@ bind pager R group-reply # Macros macro index S "mutt-notmuch-py ~/.mutt/mail/temp+temp" "search mail (using notmuch)" -macro index,pager $ "offlineimap -c ~/.mutt/offlineimaprc -k Repository_Remote:remotepass=$my_msmtp_pass &" "Force refresh" +macro index,pager $ "offlineimap -c ~/.mutt/offlineimaprc &" "Force refresh" macro index,pager \CT "~C vim@vim.org | ~C vim_use=vim~C lists.debian.org=debian~C mutt-users@mutt.org=mutt~C praat-users=praat" "Clean up mailing lists" macro index,pager \cb "|urlview\n" diff --git a/offlineimap.py b/offlineimap.py new file mode 100644 index 0000000..8d5b9cb --- /dev/null +++ b/offlineimap.py @@ -0,0 +1,11 @@ +#!/bin/env python +# -*- coding: utf-8 -*- + +import subprocess + +def mailpasswd(): + args = '/usr/bin/gpg --use-agent --quiet --batch -d /home/mart/passwd.gpg | grep -i mail | awk \'{print $3}\'' + try: + return subprocess.check_output(args, shell='/bin/bash').strip() + except subprocess.CalledProcessError: + return "" diff --git a/offlineimaprc b/offlineimaprc index 28f1ee1..ebee978 100644 --- a/offlineimaprc +++ b/offlineimaprc @@ -1,4 +1,5 @@ [general] +pythonfile = ~/.mutt/offlineimap.py metadata = ~/.mutt/offlineimap_meta accounts = net ui = quiet @@ -14,6 +15,7 @@ localfolders = ~/.mutt/mail [Repository Remote] type = IMAP +remotepasseval = mailpasswd() remotehost = mail.martlubbers.net remoteuser = mart@martlubbers.net ssl = yes -- 2.20.1