From: Mart Lubbers Date: Fri, 9 May 2014 11:20:54 +0000 (+0200) Subject: passeval X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=7b3eb9d69dd0e88553c903b7f63c7c0d1433bb09;p=dotfiles.git passeval --- 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