Re: Composing ask From: address and arbitrary keys in PGP

2019-08-08 Thread Robert
> After using your configration, it still gives me error: Source error 
> ~/.config/neomutt/profiles.d/1.rc
> 
> It seems something important is missing from the code.

There’s always the chance that copy and paste did mess up something.
Maybe this will fix it for you:

https://pastebin.com/cmJS7mz5

Good luck!
 Robert



Re: Composing ask From: address and arbitrary keys in PGP

2019-08-06 Thread tech-lists

On Thu, Aug 01, 2019 at 05:50:59AM +, Ryan Smith wrote:

The identity macro does work, but it will not work for setting custom
header in composing new emails as hdr is set before about sending
emails.
I tried gpgme which does not seems to give me any option to select
self encrypt key based on From: , but always use default key
Can you illustrate more on how to select signing key based on From:
in gpgme? gpgme seems also only uses default key as sign as if you
have multiple accounts and different for keys for each account.
Ryan


Sorry I wasn't clear. Re-reading what I wrote, seems to suggest I select
the From: and then the appropiate key gets auto-selected. That doesn't
happen. The default key remains the default key. If I select a different
From: and want a signing key for that identity, I select the appropriate
key from the gpg sign-as multi-selection.

The other way of doing it is to have two mutt sessions each running in
screen or tmux, each with different muttrc files with different
identities and different signing defaults. This is how I keep work 
emails amd mailing list emails separate.

--
J.


signature.asc
Description: PGP signature


Re: Composing ask From: address and arbitrary keys in PGP

2019-08-06 Thread Ryan Smith
On Thu, Aug 01, 2019 at 09:58:54PM +, Robert wrote:
> > > An example identity could look like this in the profiles.rc:
> > > 
> > > macro index 1 'source
> > > ~/.config/neomutt/profiles.d/1.rc'
> > > macro compose 1 'source
> > >
> > > ~/.config/neomutt/profiles.d/1.rccurrent-from'
> > > reply-hook '~C ^per...@example.com$' 'source
> > > ~/.config/neomutt/profiles.d/1.rc'
> 
> > I tried your code in both mutt and neomutt, created that 1.rc file in
> > the relevant directory, and both of them gives me error
> > 
> > Error in .muttrc,   ~/.config/neomutt/profiles.d/1.rc: unknown
> > command
> > Error in .muttrc,  
> > ~/.config/neomutt/profiles.d/1.rccurrent-from:
> > unknown command
> > Error in .muttrc,   ~/.config/neomutt/profiles.d/1.rc: unknown command
> > 
> > for mutt I also created a 1.rc file in ~.mutt/profiles.d/1.rc, still
> > gives me the same errors.
> 
> Hm, looks like you took the line breaks verbatim from the mail. Let me
> rephrase my previous code:
> 
> macro index 1 'source 
> ~/.config/neomutt/profiles.d/1.rc
> macro compose 1 'source 
> ~/.config/neomutt/profiles.d/1.rccurrent-from'
> reply-hook '~C ^per...@example.com$' 'source 
> ~/.config/neomutt/profiles.d/1.rc'
> 
> That's three lines.
> 
> > Can you check your codes to see if you typed correctly or you may have
> > left something?
> 
> Nope, that's pretty much my setup. Of course, I generate the profiles.rc
> and the profile.d/*.rc files with a script based on a yaml file, but the
> generated configuration looks just like that.
> 
> 
> Hope that helps,
>  Robert
> 

After using your configration, it still gives me error: Source error 
~/.config/neomutt/profiles.d/1.rc

It seems something important is missing from the code.

Ryan


Re: Composing ask From: address and arbitrary keys in PGP

2019-08-01 Thread Robert
> > An example identity could look like this in the profiles.rc:
> > 
> > macro index 1 'source
> > ~/.config/neomutt/profiles.d/1.rc'
> > macro compose 1 'source
> >
> > ~/.config/neomutt/profiles.d/1.rccurrent-from'
> > reply-hook '~C ^per...@example.com$' 'source
> > ~/.config/neomutt/profiles.d/1.rc'

> I tried your code in both mutt and neomutt, created that 1.rc file in
> the relevant directory, and both of them gives me error
> 
> Error in .muttrc,   ~/.config/neomutt/profiles.d/1.rc: unknown
> command
> Error in .muttrc,  
> ~/.config/neomutt/profiles.d/1.rccurrent-from:
> unknown command
> Error in .muttrc,   ~/.config/neomutt/profiles.d/1.rc: unknown command
> 
> for mutt I also created a 1.rc file in ~.mutt/profiles.d/1.rc, still
> gives me the same errors.

Hm, looks like you took the line breaks verbatim from the mail. Let me
rephrase my previous code:

macro index 1 'source 
~/.config/neomutt/profiles.d/1.rc
macro compose 1 'source 
~/.config/neomutt/profiles.d/1.rccurrent-from'
reply-hook '~C ^per...@example.com$' 'source 
~/.config/neomutt/profiles.d/1.rc'

That's three lines.

> Can you check your codes to see if you typed correctly or you may have
> left something?

Nope, that's pretty much my setup. Of course, I generate the profiles.rc
and the profile.d/*.rc files with a script based on a yaml file, but the
generated configuration looks just like that.


Hope that helps,
 Robert



Re: Composing ask From: address and arbitrary keys in PGP

2019-08-01 Thread Ryan Smith
The identity macro does work, but it will not work for setting custom header in 
composing new emails as hdr is set before about sending emails.

I tried gpgme which does not seems to give me any option to select self encrypt 
key based on From: , but always use default key

Can you illustrate more on how to select signing key based on From: in gpgme? 
gpgme seems also only uses default key as sign as if you have multiple accounts 
and different for keys for each account.

Ryan


 Original Message 
From: tech-lists 
Sent: July 27, 2019 3:55:07 PM UTC
To: mutt-users@mutt.org
Subject: Re: Composing ask From: address and arbitrary keys in PGP

On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:

> 1. When composing messages, mutt ask To: or recipient adress and 
> Subject: and then go to editor. How to make mutt ask for 
> From: or sender address only and then go to editor?

I use this, in muttrc:

# my identities
macro compose v "^Uidentity_" "Select from"

alias identity_a0 tech-lists 
alias identity_a1 someotheraddress 

[...etc...]

and use v then hit tab to get a selectable list. This selected when
about to send the email. I'm unsure what the proper name for that part
of mutt is.

I use gpgme which selects the signing key based on From:

-- 
J.


Re: Composing ask From: address and arbitrary keys in PGP

2019-08-01 Thread Ryan Smith
On 2019-07-26 21:36, Derek Martin wrote:
> On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:
>> 1. When composing messages, mutt ask To: or recipient adress and
>> Subject and then go to editor. How to make mutt ask for From: or
>> sender address only and then go to editor?
>>
> The typical way to do this is with send hooks or folder hooks.  Use
> my_hdr in one of those hooks to set the From: line.



It only works on reply messages, but not composing new messages as I
explained in my previous messages about mutt compose flow.


> 
>> 2. In PGP, mutt has crypt_opportunistic_encrypt to select keys based
>> on To: address to the recipient. But PGP also need From: address or
>> sender's key to encrypt messages, sign messages or even attch their
>> own public key. By default, mutt uses system default key or oldest
>> key created for encryption, sign messages or attach public key.
> 
> Same answer as above, but instead set pgp_sign_as.  If need be you can
> use a hook to set your pgp_encrypt_only_command and/or
> pgp_encrypt_sign_command (and set the ID to use in those, or use a
> different gnupg options file, etc.).


Again It only works on reply messages, but not composing new messages as
I explained in my previous messages.

Hence, asking From: address before getting into editor is very important
for multiple email accounts or identities setting and mutt should have
such a feature.

If it asks To: and Subject:, why not From:? If people do not like it,
mutt should also provide syntax to turn each section or all sections
off.


Re: Composing ask From: address and arbitrary keys in PGP

2019-08-01 Thread Ryan Smith
On 2019-07-26 19:30, Kevin J. McCarthy wrote:
> On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:
>>1. When composing messages, mutt ask To: or recipient adress and Subject: and 
>>then go to editor. How to make mutt ask for From: or sender address only and 
>>then go to editor?
> 
> Mutt doesn't have an option for that.  Custom From headers can be
> controlled by folder-hook, reply-hook, send-hook, or even macros;
> typically via setting my_hdr.  $edit_headers is also useful.
> 
> See  for a (somewhat
> terse) overview of message composition.


As these compose flow suggests, the hooks setting custom header or
my_hdr only work for reply messages, not compose new messages because
my_hdr is set before getting into the editor.  

Because mutt does not ask which email address or identity I use as From:
section, hooks does not know it either and hence will not generate
different headers based on different identities or email addresses
(From: address not To:)

Hooks only work if it knows emails address before getting into editor.

Therefore, maybe mutt should add such a feature, which is very important
for multiple identities or email addresses.

If it ask To: and Subject:, why not ask From:? If people do not want it
and prefer to get into editor directly, they can also turn it off.

> 
>>2. In PGP, mutt has crypt_opportunistic_encrypt to select keys based on To: 
>>address to the recipient. But PGP also need From: address or sender's key to 
>>encrypt messages
> 
> Encrypting to self is controlled by $pgp_self_encrypt and $pgp_default_key.
> 
>>, sign messages
> 
> The signing key is also controlled by $pgp_default_key, and can be
> overridden by $pgp_sign_as or the compose  "sign (a)s"
> option.

This works smoothly for one email account or one identity, (people can
set default or one pgp_self_encrypt) but not multiple identities or
email accounts where people do not want default PGP key, but provide me
a list of my own keys to choose from based on From: to encrypt.

In website, https://gitlab.com/muttmua/mutt/wikis/MuttGuide/UseGPG, the
instructions are also very short and only for one email accounts.

It is probably a good idea to provide instructions on multiple accounts
and multiple PGP keys. If we know how to do it in multiple email
accounts, we naturally know how to do it in one account.

Ryan


Re: Composing ask From: address and arbitrary keys in PGP

2019-08-01 Thread Ryan Smith
On 2019-07-27 09:42, Robert wrote:
> On 2019-07-26, 05:12, g...@riseup.net wrote:
>> 1. When composing messages, mutt ask To: or recipient adress and Subject: 
>> and then go to editor. How to make mutt ask for From: or sender address only 
>> and then go to editor?
>> This is useful for people with multiple accounts or multiple identities in 
>> each email account if they set custom headers based on each email account or 
>> identity eg, From: address.
> 
> As it has been suggested earlier, a common way to handle this is the
> reply-hook. I would like to elaborate on this a bit, since you mentioned
> custom headers per identity:
> 
> I'm using a profiles.rc file as a dispatcher for all identities
> (reply-hooks and shortcuts to toggle between identities) and as a fix
> point to include from muttrc.
> 
> Each identity is a separate rc file which is then source'd.
> 
> An example identity could look like this in the profiles.rc:
> 
> macro index 1 'source
> ~/.config/neomutt/profiles.d/1.rc'
> macro compose 1 'source
>
> ~/.config/neomutt/profiles.d/1.rccurrent-from'
> reply-hook '~C ^per...@example.com$' 'source
> ~/.config/neomutt/profiles.d/1.rc'
> 
> That'll enable the 1 shortcut in both index and compose to switch
> to profile 1. In compose it will also set the from accordingly (using a
> alias that's set inside the 1.rc).
> 
> The 1.rc might look like this:
> 
> source ~/.config/neomutt/profiles.d/clear.rc
> 
> set from="per...@example.com"
> set realname="Example Person"
> alias current-from per...@example.com (Person)
> set pgp_sign_as = ...
> set crypt_autosign = ...
> 
> set record = +sent-mail
> set postponed = +drafts
> set trash = +dustbin
> 
> clear.rc is a generic "blank profile" that resets all values so make
> sure that profiles don't bleed into each other.
> 
> And from then on you can just add all the values that you want to have
> set in this identity.
> 
> As you can see, you can even set the folders for sent mail, postponed
> messages and the trash.
> 
> Hope this helps!
>   Robert


I tried your code in both mutt and neomutt, created that 1.rc file in
the relevant directory, and both of them gives me error

Error in .muttrc,   ~/.config/neomutt/profiles.d/1.rc: unknown
command
Error in .muttrc,  
~/.config/neomutt/profiles.d/1.rccurrent-from:
unknown command
Error in .muttrc,   ~/.config/neomutt/profiles.d/1.rc: unknown command

for mutt I also created a 1.rc file in ~.mutt/profiles.d/1.rc, still
gives me the same errors.

Can you check your codes to see if you typed correctly or you may have
left something?
Ryan



Re: Composing ask From: address and arbitrary keys in PGP

2019-07-27 Thread tech-lists

On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:

1. When composing messages, mutt ask To: or recipient adress and 
Subject: and then go to editor. How to make mutt ask for 
From: or sender address only and then go to editor?


I use this, in muttrc:

# my identities
macro compose v "^Uidentity_" "Select from"

alias identity_a0 tech-lists 
alias identity_a1 someotheraddress 

[...etc...]

and use v then hit tab to get a selectable list. This selected when
about to send the email. I'm unsure what the proper name for that part
of mutt is.

I use gpgme which selects the signing key based on From:

--
J.


signature.asc
Description: PGP signature


Re: Composing ask From: address and arbitrary keys in PGP

2019-07-27 Thread Robert
On 2019-07-26, 05:12, g...@riseup.net wrote:
> 1. When composing messages, mutt ask To: or recipient adress and Subject: and 
> then go to editor. How to make mutt ask for From: or sender address only and 
> then go to editor?
> This is useful for people with multiple accounts or multiple identities in 
> each email account if they set custom headers based on each email account or 
> identity eg, From: address.

As it has been suggested earlier, a common way to handle this is the
reply-hook. I would like to elaborate on this a bit, since you mentioned
custom headers per identity:

I'm using a profiles.rc file as a dispatcher for all identities
(reply-hooks and shortcuts to toggle between identities) and as a fix
point to include from muttrc.

Each identity is a separate rc file which is then source'd.

An example identity could look like this in the profiles.rc:

macro index 1 'source
~/.config/neomutt/profiles.d/1.rc'
macro compose 1 'source

~/.config/neomutt/profiles.d/1.rccurrent-from'
reply-hook '~C ^per...@example.com$' 'source
~/.config/neomutt/profiles.d/1.rc'

That'll enable the 1 shortcut in both index and compose to switch
to profile 1. In compose it will also set the from accordingly (using a
alias that's set inside the 1.rc).

The 1.rc might look like this:

source ~/.config/neomutt/profiles.d/clear.rc

set from="per...@example.com"
set realname="Example Person"
alias current-from per...@example.com (Person)
set pgp_sign_as = ...
set crypt_autosign = ...

set record = +sent-mail
set postponed = +drafts
set trash = +dustbin

clear.rc is a generic "blank profile" that resets all values so make
sure that profiles don't bleed into each other.

And from then on you can just add all the values that you want to have
set in this identity.

As you can see, you can even set the folders for sent mail, postponed
messages and the trash.

Hope this helps!
  Robert



Re: Composing ask From: address and arbitrary keys in PGP

2019-07-26 Thread Derek Martin
On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:
> 1. When composing messages, mutt ask To: or recipient adress and
> Subject and then go to editor. How to make mutt ask for From: or
> sender address only and then go to editor?
> 
The typical way to do this is with send hooks or folder hooks.  Use
my_hdr in one of those hooks to set the From: line.

> 2. In PGP, mutt has crypt_opportunistic_encrypt to select keys based
> on To: address to the recipient. But PGP also need From: address or
> sender's key to encrypt messages, sign messages or even attch their
> own public key. By default, mutt uses system default key or oldest
> key created for encryption, sign messages or attach public key. 

Same answer as above, but instead set pgp_sign_as.  If need be you can
use a hook to set your pgp_encrypt_only_command and/or
pgp_encrypt_sign_command (and set the ID to use in those, or use a
different gnupg options file, etc.).

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



pgp99hj0x7amQ.pgp
Description: PGP signature


Re: Composing ask From: address and arbitrary keys in PGP

2019-07-26 Thread Kevin J. McCarthy

On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:
1. When composing messages, mutt ask To: or recipient adress and 
Subject: and then go to editor. How to make mutt ask for From: or 
sender address only and then go to editor?


Mutt doesn't have an option for that.  Custom From headers can be 
controlled by folder-hook, reply-hook, send-hook, or even macros; 
typically via setting my_hdr.  $edit_headers is also useful.


See  for a (somewhat 
terse) overview of message composition.


2. In PGP, mutt has crypt_opportunistic_encrypt to select keys based on 
To: address to the recipient. But PGP also need From: address or 
sender's key to encrypt messages


Encrypting to self is controlled by $pgp_self_encrypt and 
$pgp_default_key.



, sign messages


The signing key is also controlled by $pgp_default_key, and can be 
overridden by $pgp_sign_as or the compose  "sign (a)s" option.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Composing ask From: address and arbitrary keys in PGP

2019-07-25 Thread Ryan Smith
On Fri, Jul 26, 2019 at 05:12:08AM +, g...@riseup.net wrote:
> 1. When composing messages, mutt ask To: or recipient adress and Subject: and 
> then go to editor. How to make mutt ask for From: or sender address only and 
> then go to editor?
> 
> This is useful for people with multiple accounts or multiple identities in 
> each email account if they set custom headers based on each email account or 
> identity eg, From: address.
> 
> 2. In PGP, mutt has crypt_opportunistic_encrypt to select keys based on To: 
> address to the recipient. But PGP also need From: address or sender's key to 
> encrypt messages, sign messages or even attch their own public key. By 
> default, mutt uses system default key or oldest key created for encryption, 
> sign messages or attach public key. 
> 
> How to choose arbitrary keys from PGP key chain as From: or sender's key to 
> sign, encrypt or attach? Are there also some  
> "From_crypt_opportunistic_encrypt" based on sende' key?
> 

It is probaby a good idea if mutt has an option to show a list of all PGP  keys 
that people can choose from, as From: or sender's key to sign, encrypt or 
attach,  every time they compose a PGP message, if they have multiple email 
accounts. 

Such option may even also be good for choosing recipient key because some 
people use PGP keys that are different from their email address.

> People with multiple accounts or multiple identities in each email account 
> may want to use different keys that match their corresponding email accounts 
> or From: address to sign, encrypt or attach in corresponding messages.
> 
> Ryan
> 
> 


Composing ask From: address and arbitrary keys in PGP

2019-07-25 Thread GTC
1. When composing messages, mutt ask To: or recipient adress and Subject: and 
then go to editor. How to make mutt ask for From: or sender address only and 
then go to editor?

This is useful for people with multiple accounts or multiple identities in each 
email account if they set custom headers based on each email account or 
identity eg, From: address.

2. In PGP, mutt has crypt_opportunistic_encrypt to select keys based on To: 
address to the recipient. But PGP also need From: address or sender's key to 
encrypt messages, sign messages or even attch their own public key. By default, 
mutt uses system default key or oldest key created for encryption, sign 
messages or attach public key. 

How to choose arbitrary keys from PGP key chain as From: or sender's key to 
sign, encrypt or attach? Are there also some  
"From_crypt_opportunistic_encrypt" based on sende' key?

People with multiple accounts or multiple identities in each email account may 
want to use different keys that match their corresponding email accounts or 
From: address to sign, encrypt or attach in corresponding messages.

Ryan