Re: New to Mutt, unable to send messages in *any* attempted way

2022-05-11 Thread Sam Kuper
On Wed, May 11, 2022 at 10:54:19AM -0500, X Tec wrote:
> Managed to briefly test in a more updated rig with Mutt 2.2.4 and
> Msmtp 1.8.11.

Good job.

I'm in haste, so am skipping over the msmtp password oddness.  Maybe
another list subscriber will take that up.


> The passwordeval with gpg method also works, albeit I wasn't able to
> figure out how to use it directly in command line... Trying to use
> 
> set sendmail="/usr/bin/msmtp [...] --passwordeval="gpg --no-tty -q -d 
> ~/.user.gpg""
> 
> got this:
> 
> Error in command line: --no-tty: unknown variable
> gpg: WARNING: no command supplied. Trying to guess what you mean ...
> gpg: processing message failed: Unknown system error
> msmtp: cannot read output of 'gpg'
> Error sending message, child exited 78 ().
> Could not send the message.
> 
> I did figure it's an issue with wrongly used quotes (and the gpg
> command needs them), but still haven't been able to solve it...


https://tldp.org/LDP/abs/html/quotingvar.html

https://mywiki.wooledge.org/Quotes


Once you know your shell's quoting syntax, you will see that you can
probably achieve your goal in any of several different ways.  Which to
use is a matter of taste.

E.g.

'/home/.user.gpg'

vs

"~"'/.user.gpg'

If you still find yourself stuck (or even if you don't), you might want
to try using Pass as a wrapper around GPG:

https://en.wikipedia.org/wiki/Pass_%28software%29




> On 2022-05-11 09:03:56, Cameron Simpson wrote:
>> On 10May2022 07:25, Sam Kuper  wrote:
>>> On Mon, May 09, 2022 at 11:01:20PM -0500, x...@trimaso.com.mx wrote:
 ---To respond a received email in Mutt pager I hit 'r', and all the
 rest. I only change the destination email address, and eventually
 send. But even after successfully sent, the "responded" email in Mutt
 pager is not marked with 'r'. Why?
>>>
>>> Maybe because in your examples above, you set the record variable to
>>> ""?
>>>
>>> I may be wrong, but: I think that in order for Mutt to know whether
>>> a message has been replied to, it checks the mailbox specified by
>>> the record variable - so if that variable is empty, Mutt has no way
>>> of checking.
>> 
>> I thought it just set a flag on the message.
>> 
>> I forget, is XTec using a local or IMAP mail folder?
>
> Current IMAP settings (using Starttls):
> set folder = "imap://u...@domain.tld@smtp.domain.tld"
> set spoolfile = +INBOX
> mailboxes = +INBOX
> 
> Also,
> set record = ""
> set date_format = "%F %T"
> set index_format = "%4C %Z %D %-15.15L (%?l?%4l&%4c?) %s"
> set sort = reverse-date
> 
> By using '$' I just get "Mailbox is unchanged", even when I know there
> are new messages.  The only thing that *seemed* to work was "bind
> index G imap-fetch-mail" in .muttrc.  With this, I could use 'G' to
> refresh for newly received emails Still, I kind of expected a
> "default" key for that...
> 
> 
> 
> ---Just like Msmtp, if the better idea is to not store passwords in
> plain text, doesn't Mutt have some type of password "masking" or
> something? With GPG, hashed into another file somewhere else, etc...

Yes, Mutt does have a way to achieve that.

I hate so say "Read The Friendly Manual", but within

https://www.mutt.org/doc/manual/#muttrc-syntax

you will find this example:

set imap_pass="`gpg --batch -q --decrypt ~/.mutt/account.gpg`"

https://www.mutt.org/doc/manual/#ex-backtick-dblquotes


Best,

Sam


-- 
A: When it messes up the order in which people normally read text.
Q: When is top-posting a bad thing?

()  ASCII ribbon campaign. Please avoid HTML emails & proprietary
/\  file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.


Re: New to Mutt, unable to send messages in *any* attempted way

2022-05-11 Thread X Tec
Managed to briefly test in a more updated rig with Mutt 2.2.4 and Msmtp 1.8.11.



On Tue, May 10, 2022 at 07:25:02AM +, Sam Kuper wrote:
> Consider adding ` --` (without backticks) to the end of the
> sendmail string in your example above.
>
printf "%b\n" "$msg" | mutt -s "Test message" -e 'set 
my_user="u...@domain.tld"; set my_url="smtp.domain.tld"; set record=""; set 
from="Send User<$my_user>"; set envelope_from=yes; set sendmail="/path/to/msmtp 
--port=587 --tls=on --host=$my_url --auth=on --user=$my_user"' 
recei...@domain.tld

Trying to add "--" did not work at all, no matter where I put it:
[...] sendmail="[...] --"' recei...@domain.tld
[...] sendmail="[...]"' -- recei...@domain.tld

If using the more standard method, without all the msmtp parameters above and 
using .msmtprc instead, it must have *all* the complete needed commands; if it 
only has the "password" line it fails with the same error as well.

So for this to work, I had to make a ~/.netrc file with content:

machine smtp.domain.tld
login u...@domain.tld
password p4ss

(Yes, Msmtp manual says this method is deprecated...)



> - Why you say '"--password" is not a valid command line option'.
>
Yes, according to manual "password" is a valid command for .msmtprc; but 
there's no "--password" option for command line. I tried this last one and got 
something like "invalid or unknown command".



The passwordeval with gpg method also works, albeit I wasn't able to figure out 
how to use it directly in command line... Trying to use

set sendmail="/usr/bin/msmtp [...] --passwordeval="gpg --no-tty -q -d 
~/.user.gpg""

got this:

Error in command line: --no-tty: unknown variable
gpg: WARNING: no command supplied. Trying to guess what you mean ...
gpg: processing message failed: Unknown system error
msmtp: cannot read output of 'gpg'
Error sending message, child exited 78 ().
Could not send the message.

I did figure it's an issue with wrongly used quotes (and the gpg command needs 
them), but still haven't been able to solve it...



On 2022-05-11 09:03:56, Cameron Simpson wrote:
> On 10May2022 07:25, Sam Kuper  wrote:
> >On Mon, May 09, 2022 at 11:01:20PM -0500, x...@trimaso.com.mx wrote:
> >> ---To respond a received email in Mutt pager I hit 'r', and all the
> >> rest. I only change the destination email address, and eventually
> >> send. But even after successfully sent, the "responded" email in Mutt
> >> pager is not marked with 'r'. Why?
> >
> >Maybe because in your examples above, you set the record variable to ""?
> >
> >I may be wrong, but: I think that in order for Mutt to know whether a
> >message has been replied to, it checks the mailbox specified by the
> >record variable - so if that variable is empty, Mutt has no way of
> >checking.
> 
> I thought it just set a flag on the message.
> 
> I forget, is XTec using a local or IMAP mail folder?
> 
Current IMAP settings (using Starttls):
set folder = "imap://u...@domain.tld@smtp.domain.tld"
set spoolfile = +INBOX
mailboxes = +INBOX

Also,
set record = ""
set date_format = "%F %T"
set index_format = "%4C %Z %D %-15.15L (%?l?%4l&%4c?) %s"
set sort = reverse-date

By using '$' I just get "Mailbox is unchanged", even when I know there are new 
messages.
The only thing that *seemed* to work was "bind index G imap-fetch-mail" in 
.muttrc.
With this, I could use 'G' to refresh for newly received emails
Still, I kind of expected a "default" key for that...



---Just like Msmtp, if the better idea is to not store passwords in plain text, 
doesn't Mutt have some type of password "masking" or something? With GPG, 
hashed into another file somewhere else, etc...



Thanks again for your attention.