You are not logged in.

#1 2020-08-24 01:56:16

claudici
Member
Registered: 2020-07-28
Posts: 21

[SOLVED] Mutt/Neomutt Multiple Email Passwords

I was able to get both my email accounts working in neomutt. I can open each account folder via the sidebar which is great. One problem however....

Whenever I open neomutt, I have to enter the decryption password (I am using gnupg + pass) for each acccount, THEN I have to enter the password to open the INBOX for the second account. The second account inbox folder is ALWAYS the one that is defaulted to -- probably because it is the last one to be sourced in neomuttrc. So I end up having to type in three passwords just to get into my emails which is a bit tedious...

A few questions:

  1. Is it possible to select the account I first want to use when I open neomutt? I'd still like to type in the password for that account for security purposes

  2. When I select a different folder to open via the sidebar, I am prompted for the password for that IMAP account just to get into the folder, even if I am already in a folder associated with that account. Is there any way to make it so that the password is "remembered" between folders with the same IMAP account?

  3. To add onto that, could I somehow "cache" the IMAP account passwords once I am inside neomutt? So that way I don't have to enter an IMAP pass when switching between accounts.

Here are my configs:

$HOME/.config/neomutt/neomuttrc

#
# Omitted
#
# AccA email account
source "~/.config/neomutt/accA"
folder-hook $folder 'source ~/.config/neomutt/accA'

# AccB email
source "~/.config/neomutt/accB"
folder-hook $folder 'source ~/.config/neomutt/accB'
#
# Omitted
#

$HOME/.config/neomutt/accA

# Config file for hostA email account
# Sourced in neomuttrc

# Connect to hostA mail server 
set folder = "imaps://userA@hostA.com:993"

## Secure connection information
set ssl_starttls=yes
set ssl_force_tls=yes
set smtp_url = "smtp://userA@hostA.com:587"
set imap_pass="`gpg --batch -q --decrypt ~/.local/share/pass/user@hostA.com.gpg`"

# From address
set from = "userA@hostA.com"
set realname = "User A"
set use_from = yes

# Some inboxes
set spoolfile = "+INBOX"
set record = +Sent
set trash = +Trash
set postponed = +Drafts

# See dovecot.conf for mailbox setup
mailboxes "+---------Host A---------" =INBOX =Drafts =Sent =Trash =Junk =Archive "+---------Host B--------"

account-hook $folder "set imap_user=userA@hostA.com"

$HOME/.config/neomutt/accB

# Config file for hostB email account
# Sourced in neomuttrc

# Connect to Gmail server
set folder = "imaps://userB@hostB.com@imap.gmail.com:993"

## Secure connection information
set ssl_starttls=yes
set ssl_force_tls=yes
set smtp_url = "smtp://userB@hostB.com@smtp.gmail.com:587"
set imap_pass="`gpg --batch -q --decrypt ~/.local/share/pass/userB@hostB.com.gpg`"

# From address
set from = "userB@hostB.com"
set realname = "User B"
set use_from = yes

# Some inboxes
set spoolfile = "+INBOX"
unset record
set trash = +[Gmail]/Trash
set postponed = +[Gmail]/Drafts

mailboxes =INBOX =[Gmail]/Starred =[Gmail]/Sent\ Mail =[Gmail]/Drafts =[Gmail]/All\ Mail =[Gmail]/Spam =[Gmail]/Trash

account-hook $folder "set imap_user=userB@hostB.com"

Last edited by claudici (2020-08-24 14:11:30)

Offline

#2 2020-08-24 03:00:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Mutt/Neomutt Multiple Email Passwords


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2020-08-24 03:16:08

merlock
Member
Registered: 2018-10-30
Posts: 262

Re: [SOLVED] Mutt/Neomutt Multiple Email Passwords

1.  Set up an agent.  I use keychain

2.  Refer to the Wiki

Your '.my-pwds.gpg' file should look like this:

set my_pass = (passwd for accA)
set my_pass1 = (passwd for accB)

Change your folder hooks:

account-hook $folder "set imap_user=userA@hostA.com imap_pass=$my_pass"
account-hook $folder "set imap_user=userB@hostB.com imap_pass=$my_pass1"

Don't forget to source the '.my-pwds.gpg' file, before any accounts:

source "gpg -dq $HOME/.my-pwds.gpg |"

Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#4 2020-08-24 14:11:07

claudici
Member
Registered: 2020-07-28
Posts: 21

Re: [SOLVED] Mutt/Neomutt Multiple Email Passwords

merlock wrote:

1.  Set up an agent.  I use keychain

2.  Refer to the Wiki

Your '.my-pwds.gpg' file should look like this:

set my_pass = (passwd for accA)
set my_pass1 = (passwd for accB)

Change your folder hooks:

account-hook $folder "set imap_user=userA@hostA.com imap_pass=$my_pass"
account-hook $folder "set imap_user=userB@hostB.com imap_pass=$my_pass1"

Don't forget to source the '.my-pwds.gpg' file, before any accounts:

source "gpg -dq $HOME/.my-pwds.gpg |"

Thanks got it working had to have the line set imap_pass = "$my_pass" for initial login as well. Now I only type in one password when I open neomutt which is what I wanted. Marking as solved.

Offline

Board footer

Powered by FluxBB