[S-mailx] v14.10: will drop ?single modifier for address fields

2024-01-10 Thread Steffen Nurpmeso
Hello.

I wish everyone a good and hopefully healthy and peacful 2024!

v14.10 will take time, as i said.  It is delayed even further
because i am about to write a small DKIM signer, because Google
will enforce that for mailing-lists (it causes defers for this ML
since maybe november, already!), and i am not happy with what is
available.  Will be a very hard task to do so in the next two and
a half weeks!

One of the problems is that a RFC 5322 aka Internet Message Format
aka email header parser is required.  I cannot use the terrible
one that the codebase of this MUA uses, so i am about to write
a new one from scratch.

It will be hard to add the hacks we need for BSD Mail to get
right, but it would be a lunatic experience to add support for the
?single modifier that i introduced for address fields (see for
example -t command line option docu)!
I am pretty sure noone is actually using this except our tests :),
since email addresses tend to be simple (the big ones *radically*
enforce that for their users, for example), other MUAs, like mutt,
simply fail for, or mutilate user input of that sort, and then we
do have the `addrcodec' command, actually, which can be used to
create acceptable input.  (This has to improve.)

So my thinking is that i radically drop support for the ?single
modifier for addresses, of which, i am quite sure, most of you
have never heard, but very, very likely never used.  Interested'
in comments!

Ciao, and a good time i wish!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] s-nail misses verp delimiter "+" support?

2024-01-08 Thread Steffen Nurpmeso
Hello Peter,

Peter Bieringer wrote in
 :
 |Am 06.01.24 um 22:41 schrieb Steffen Nurpmeso:
 |> Peter Bieringer wrote in
 |>   :
 |>|during migration and testing an e-mail system coming from Enterprise
 |>|Linux 8 to 9 it turned out that EL9 has no longer "mailx" but "s-nail"
 |>|packaged.
 |>|
 |>|And the behavior regarding verp delimiter "+" support is different,
 |>|"s-nail" is missing it.
 |> 
 |> It is not valid alias content.
 |
 |Thank you for your hints, found at least a workaround:
 |
 |echo "Test" | mail -s "Test" account+sub@$HOSTNAME
 |
 |> Interesting that you try to test a verp delimiter address.
 |
 |It is a special construct for sharing one local mailbox user and having 
 |special "sub" handling via maildrop's mailfilter like (excerpt):
 |
 |import LOCAL
 |import RECIPIENT
 |import SENDER
 |import EXTENSION
 |
 |log "INFO: LOCAL=$LOCAL RECIPIENT=$RECIPIENT SENDER=$SENDER
 |
 |FINALSENDER="postmaster@domain.example"
 |
 |if ( $EXTENSION eq "test" )
 |{
 | FINALRECEPIENT="user@otherdomain.example"
 |}
 |
 |if ( $FINALRECEPIENT ne "" )
 |{
 | log "ACT : forward FROM=$FINALSENDER TO=$FINALRECEPIENT"
 | xfilter "reformail"
 | /^.*/
 | to "| $SENDMAIL -f $FINALSENDER $FINALRECEPIENT"
 |}

..no idea, but it is ok..

Ciao, Peter.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] s-nail misses verp delimiter "+" support?

2024-01-06 Thread Steffen Nurpmeso
Hello Peter, welcome.

Peter Bieringer wrote in
 :
 |during migration and testing an e-mail system coming from Enterprise 
 |Linux 8 to 9 it turned out that EL9 has no longer "mailx" but "s-nail" 
 |packaged.
 |
 |And the behavior regarding verp delimiter "+" support is different, 
 |"s-nail" is missing it.

It is not valid alias content.

 |EL8:
 |
 |$ rpm -qf $(which mail)
 |mailx-12.5-29.el8.x86_64
 |
 |$ echo "Test" | mail -s "Test" account+sub
 |
 |=> delivery is working
 |
 |EL9:
 |
 |$ rpm -qf $(which mail)
 |s-nail-14.9.22-6.el9.x86_64

They should update this for enterprise, many bugs fixed on the way
to v14.9.24.

 |$ echo "Test" | mail -s "Test" account+sub
 |s-nail: account+sub is an invalid alias name
 |s-nail: No recipients specified
 |/root/dead.letter 3/41
 |s-nail: ... message not sent
 |
 |=> not able to send to such recipient
 |
 |Any hints how to test with "s-nail" recipients containing verp delimiter 
 |"+"?

Specifying a full address should help you out.

  #?4|kent:nail.git$ 

Re: [S-mailx] ..not this year no more..

2023-12-16 Thread Steffen Nurpmeso
Z  wrote in
 <657910d6.NUFVWnXSo/mqguu8%zi...@sdf.org>:
 |

I am also speechless, i am sad :(.
But compared to the version you use already a bit has changed.
Unfortunately not enough.

 --End of <657910d6.NUFVWnXSo/mqguu8%zi...@sdf.org>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|
| Only in December: lightful Dubai COP28 Narendra Modi quote:
|  A small part of humanity has ruthlessly exploited nature.
|  But the entire humanity is bearing the cost of it,
|  especially the inhabitants of the Global South.
|  The selfishness of a few will lead the world into darkness,
|  not just for themselves but for the entire world.
|  [Christians might think of Revelation 11:18
|The nations were angry, and your wrath has come[.]
|[.]for destroying those who destroy the earth.
|   But i find the above more kind, and much friendlier]


Re: [S-mailx] ..not this year no more..

2023-12-13 Thread Steffen Nurpmeso
John Dodson wrote in
 <1fe2f0055b88c96d338c8a22648a2feb88f39f0f.ca...@bigpond.com>:
 |Dear Steffen,
 |Thank you for all your efforts on s-nail, I wish you a very good
 |festive season!

Thank you very much, John Dodson!  It is only a little thing.

Greetings to beautiful Australia -- Christmas in Summer must
be strange, .. was it you who told the story of the beach session
in the past, i wonder?  Here, for beach feelings, we currently
only have to lift our hats to get wet, that much is plain :)

All the best to you and your family!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|
| Only in December: lightful Dubai COP28 Narendra Modi quote:
|  A small part of humanity has ruthlessly exploited nature.
|  But the entire humanity is bearing the cost of it,
|  especially the inhabitants of the Global South.
|  The selfishness of a few will lead the world into darkness,
|  not just for themselves but for the entire world.
|  [Christians might think of Revelation 11:18
|The nations were angry, and your wrath has come[.]
|[.]for destroying those who destroy the earth.
|   But i find the above more kind, and much friendlier]


[S-mailx] ..not this year no more..

2023-12-12 Thread Steffen Nurpmeso
Dear list members.

While currently implementing a fully populated character set
database in order to truly be able to deal with the standardized
iconv(3) that unfortunately does not offer normalize() and things
like is_ascii() or such, even though it necessarily ships with all
necessary information internally, i realized that the goal to
release v14.10 (which, unfortunately, is not v15!) this year
will.not.work.out.

Sorry.  There is still too much to do, and then you stumble over
such things like this, which takes over a day to implement.  And
then you download IETF data and it is totally messed up compared
to an over a decade old version i locally had all this time, since
they seem to killed their tool chain.

More and more features and bug fixes come in (like
freely-configurable message-ids, bracketed-paste mode, massively
improved MIME conformance -- take just this:

$ 

Re: [S-mailx] smtp settings for outlook.com

2023-11-15 Thread Steffen Nurpmeso
Morten Bo Johansen wrote in
 :
 |Thanks for taking time, Steffen!
 |
 |I have solved it simply by setting
 |
 |  set mta="/usr/bin/msmtp"
 |
 |in my ~/.mailrc, and now it works.
 |
 |So msmtp has no problems. Perhaps by studying the source code
 |for msmtp might be helpful?

I will not link against a SASL library, and such.
As far as i know you have to pass the password to msmtp, it does
not do that except doing the SMTP handshake.
Other than that it likely is a brilliant decision.

Ciao,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] smtp settings for outlook.com

2023-11-15 Thread Steffen Nurpmeso
Morten Bo Johansen wrote in
 :
 |It seems very complicated, but I'll look into it.

Well you cannot get around creating the resource file.
Then it could be as easy as

  #!/bin/sh -

  pass=$(python3 oauth-helper.py --action access \
--resource YOUR-RC-FILE)
  exec s-nail -S password="$pass" YOUROPTS "$@"

at least for the minutes until the password times out.
Unfortunately with Microsoft that becomes an interactive mess.

I do not know what to do about that.  Yandex is silent for many
many months (timeout=31536000!), even notorious Google is.  No
problem, after almost a month silence, just --access, no
interaction, nothing.  I do not know why Microsoft is such
a bitter bitch.  (I do not even know whether that term is
gender-technically still acceptable.)

I mean if v14.10 ships the macros in some "library-rc" file, then
xoauth usage could be as simple as, for example,

  set oauth-config-path=DIR

(or so, for the config files) and in each account

  call oauth-activate ACCOUNT-NAME

(though v14.10 also has an *account* variable so we could actually
deduce even that).

Like i said i do not yet know how to deal with these issues, OAuth
is a terrible thing (even in the XOAuth SASL version), and it
seems the next step is something passwordless or what.

I presume whatever will be in v14.10 will not be the last word,
and i cannot work without at least some user configuration.
I do not have the resource to implement a full OAuth 2.0 client,
nor do i know any program other than big browsers or so which have
such.  And for example the oauth script of mutt seems much less
flexible than our one, and does not support Yandex, for example?

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] smtp settings for outlook.com

2023-11-15 Thread Steffen Nurpmeso
Hello Morten.

Morten Bo Johansen wrote in
 :
 |Is anybody able to send mail with s-nail through the outlook.com smtp \
 |server?

Just yesterday (because on some other list someone had problems)
i logged into IMAP.  (I use v14.10 development branch though.)

 |I have this in my ~/.mailrc:
 |
 |   set v15-compat
 |   
 |   account hotmail {
 |  localopts yes
 |  set from="Morten Bo Johansen "
 |  set imap-keepalive=240
 |  shortcut imap imaps://outlook.office365.com
 |  set tls-config-pairs=MinProtocol=TLSv1.2
 |  set smtp-use-starttls
 |  set mta=smtp://mortenbo%40hotmail.com:sec...@smtp-mail.outlook.com:58\
 |  7

Microsoft likely enforces OAuth.  I have written a Python program
(Python because it ships all necessary modules out of the box)
which handles the stuff:

  curl -b ./TMPCOOKIE -c ./TMPCOOKIE \
-O https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

(No longer authentication required, but sets HTTP cookie.)
It needs a configuration file,

  python3 oauth-helper.py -p Microsoft -R morten.rc --action=template

creates it (see --help).  flow= must be auth however, i think.
Last night i had

  # /home/steffen/sec.arena/mail/.sitm-ms.oauth, written 2023-11-15 
00:29:01.875595
  
authorize_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize
  
devicecode_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/devicecode
  token_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/token
  redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient
  tenant=common
  scope=https://outlook.office.com/IMAP.AccessAsUser.All 
https://outlook.office.com/POP.AccessAsUser.All 
https://outlook.office.com/SMTP.Send
  flow=auth
  access_token=
  client_id=bf0f4488-089e-46ee-a48d-8f0717388be3
  login_hint=sugar.in.the.morn...@outlook.com

^ change this

  timeout=3600
  timestamp=
  refresh_token=

Last October i posted a v14.9.* script that makes use of this (but
do not use oauth-helper.py from that post, current is beter); i no
longer have it nor tried it ever since, i am all forward on v14.10
[1].

  [1] https://lists.sdaoden.eu/pipermail/s-mailx/2022-October/001650.html

Note Microsoft uses grazy-long tokens and requires a browser visit
each and every time the token expires (ie a normal refresh will
not work out).  The new token is also only seen in the browser
address line.

 |I get various error messages, no matter what I try, e.g.:
 |
 | $ mail -s "Test" morte...@hotmail.com < /dev/null 
 |   
 |  mail: SMTP server: 504 5.7.4 Unrecognized authentication type
 |   [MM0P280CA0062.SWEP280.PROD.OUTLOOK.COM 2023-11-15T13:28:04.587Z
 |   08DBE55409C962D3]
 |  
 |If I try with smtps://.. instead of smtp, I get
 |
 |  $ mail -s "Test" morte...@hotmail.com < /dev/null
 |mail: could not initiate TLS connection: error:0A00010B:SSL routines::w\
 |rong
 |version number
 |  
 |I have also tried to remove the "tls-config-pairs" line to no effect.
 |
 |These are my "tls-features":  
 ...
 IMAP works fine. It is just smtp that doesn't work.

Oh.  Wait.  SMTP i have not tried.

  $ s-nail -A sitm-ms -s 'SMTP should work' stef...@sdaoden.eu
  ! Warning: --resource mode permissions other than user read/write: 0640: 
/home/steffen/sec.arena/mail/.sitm-ms.oauth
! refresh_token response: HTTP Error 400: Bad Request
! Let us try --authorize instead (sleeping 3 seconds)

^ Always with Microsoft :(  Yandex is much more relaxex.  Even
Google.

  * OAuth 2.0 RFC 6749, 4.1.1. Authorization Request
. To create an authorization code, please visit the shown URL:

  lynx-redux 'https://login.microsoftonline.com/[.]'

^ $BROWSER that is

  - Shall i invoke this command? [y/else] n

  Please enter authorization [URI?code=]token: [.]

  * OAuth 2.0 RFC 6749, 4.1.3. Access Token Request
  s-nail:  .. updating password to OAuth token [.]
  s-nail: Conditional expression: expected an operator: stop during: =~ 
^imaps?://: of: =~ ^imaps?://

(oops, a bug)

  s-nail: Obsoletion warning: conditional expressions exclusively use 
shell-style notation; compatibility shims were removed!

  ...
  (Preliminary) Envelope contains:
  ...
  Send this message [yes/no, empty: recompose]? y
  ...
  #?0|kent:nail.git$

Works!
Now i hope this works with v14.9.24 also.  Its oauthbearer
authentication should be xoauth2 indeed, please complain if it
does not work.  (I hate OAuth.)

I am undecided how to do it for this MUA indeed.  I personally now
do "call oauth-activate sitm-ms" from within my account:

  define oauth-activate {
  \se password imap-auth=xoauth2 [.]
  \call oauth-check-token-init
  \se oauth-helper='$HOME/src/toolbox.git/oauth-helper.py \
  --resource $HOME/sec.arena/mail/.'$1'.oauth' \
  oauth-helper-times=$HOME/sec.arena/mail/.$1.oauth \
  on-oauth-password-change=_oauth-on-new-token
  }

  define 

Re: [S-mailx] v14.10: on-compose-embed obsoletes on-compose-splice(-shell)

2023-11-04 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20231027005525.262-f%stef...@sdaoden.eu>:
 ...
 |  \local vput fop _smime-sign-cert expand "$_smime-sign-cert"
 ...
 |\local vput vexpr sec seconds
 ...
 | local pp local vput global vpospar i$((i = 1 + 1)) quote
 ...

Now that made me so weird that i finally (it was in TODO)
implemented a different syntax that reminds of sh(1)ell
redirection.  In v14.10 we will instead have

 \local >_smime-sign-cert fop expand "$_smime-sign-cert"
 \local >sec vexpr seconds
 local pp local >i$((i = 1 + 1)) global vpospar quote

Ie instead of "vput CMD VAR" there is ">VAR CMD" in "natural"
order.  I have completely switched the syntax, and obsoleted vput.
The > modifier can then later also be extended, maybe >{varname}
and > or so, but for now i am happy.  Except that now the
history entry of

  local pp local >i$((i = 1 + 1)) global vpospar quote

says for example

  local pp local >i2 global vpospar quote

which is not optimal (like history in general).  But i am afraid
that fix not in v14.10(.0, at least).  I hope for Christmas.

A nice Sunday i wish, i hope you can.
Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] v14.10: on-compose-embed obsoletes on-compose-splice(-shell)

2023-10-26 Thread Steffen Nurpmeso
Hello.

The state machine of v14.10 will be (still hacky but) good enough
to drive *on-compose-embed* via a normal macro that runs _in the
current process_, instead of in a forked subprocess that needs to
be driven very complicatedly.
So, in v14.10 a signature can be done just like

  set on-compose-embed=mysig
  define mysig {
~< ~/.mysig
  }

I think that is simple enough: *signature* remains obsoleted.
But i will obsolete *on-compose-splice* and
*on-compose-splice-shell* in v14.10.

May thou speak up now on complains, please.

Already Ciao!
and greetings!
from Germany for the occasional lurker!


===

We also support "match groups" for regular expressions and such,
and for "in-memory" results for `~^^' (new, for that purpose) or
`digmsg', which is pretty cool (as the I/O protocol used by the
splice hooks is no longer necessary at all).
For a simple example, here is my personal

  define on-compose-leave {
\call age

^"can"

\if -N smime-sign && -N _smime-sign-cert
  \local vput fop _smime-sign-cert expand "$_smime-sign-cert"
  \if -r "$_smime-sign-cert"

^file exists?

\dig - atta ins "$_smime-sign-cert"

^insert as attachment 

\if $^0 -eq 210

^"Match group" used to represent result status in-memory.

  \dig - atta attribute-set-at $^1 \

^"Match group" still alive and well (^1 == index of attachment)

  content-description S/MIME certificate for stef...@sdaoden.eu
  \ec S/MIME: $^0
\el
  \ec S/MIME error $^0: $^*
\en
  \en
\en

\local vput vexpr sec seconds
\if $? -ne 0; \return; \en
\local pp : $((e = sec / 60 % 60))
\if $e -eq 42
  : $((e = -((sec % 60) - 60)))
  \ec 'Minute 42, sleeping '$e' seconds'
  \sleep $e
\el
  : $((e = sec % 42))
  \if $e -eq 42
\ec 'Second 42, sleeping a second'
\sleep 1
  \en
\en
  }

We gain more scope control, too.  The very grazy hypothetic

   define hi {
 local pp local vput global vpospar i$((i = 1 + 1)) quote
 xcall t "$@"
   }

keeps the modifications of the $(()) construct "local pp"
(positional parameters), keeps the assignment to the resulting
iNUMBER variable "local vput", but modifies the "global"
positional parameter stack.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] v14.10 release delayed further (but this year for sure)

2023-08-16 Thread Steffen Nurpmeso
Hello list.

I am sorry, i am not fooling you, even though i write the same
thing over and over again.  But autumn equinox is too soon.

Yes but for example i discovered a bug in the `local' scoping
rules ("local xcall", aka tail-call optimized call), as well as
one in the `environ link' scope-unroll code.
That made me so angry that i applied some "scope work", which, due
to time constraints, took over a month to complete.
But it gave us `our' (our set, our call), which rather mirrors
what for example bash(1) does with its "local" modifier for
variables.  (And a bit.)

And about to optimize MIME inspection of attachments so that it
happens only once.  Yay!

And more is finally placed in TODO again (i had a private .TODO
for a few years), with the remains of what is to be done.

So, and as i really plan to head for the v15 (MIME layer and I/O)
rewrite after v14.10, i want to deal with as many TODO options as
possible in v14.10.

Thank you for your understanding, and apologies!  I think i wanted
to release it over a year ago.

Ciao from Germany.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Show the From: headers of the last 25 messages on stdout?

2023-07-01 Thread Steffen Nurpmeso
Morten Bo Johansen wrote in
 :
 |On 2023-06-30 Steffen Nurpmeso wrote:
 ...

GMANE is great, i use it every day.

 |>   YOURFILE=imaps://mail.server.com
 |>  vput = i \$
 |>   eval i $i -le 25
 |> se j=1
 |>   ele
 |> vput vexpr j - $i 25
 |>   en
 |>   sea ${j}-$i
 |>   xit
 |> ' $YOURFILE
 |>
 |
 |I use: YOURFILE=imaps://mail.simply.com
 |
 |It doesn't quite work. It just says:
 |
 |  m...@mail.simply.com requires a password:
 |  mail: A password is necessary for imap authentication
 |
 |but user and password is in my ~/.netrc. How can I tell your
 |script to use that?

Leave off -":/" flag to read your normal $MAILRC?
(You also do not need "xit" with "

Re: [S-mailx] Show the From: headers of the last 25 messages on stdout?

2023-06-30 Thread Steffen Nurpmeso
Hello.

iirc i whitelisted the other address of yours.

Morten Bo Johansen wrote in
 :
 |Can I do that?
 |
 |E.g.:
 |
 |  echo from  | mail -f imaps://mail.server.com
 |  
 |But how do I specify the last 25 messages?

  YOURFILE=imaps://mail.server.com
  

[S-mailx] v14.10 not before autumn equinox

2023-06-23 Thread Steffen Nurpmeso
Hello list.

I am sorry to have to say that the next release needs even more
time, but three major items on its plan are still missing,
development is slow due to time constraints, and little unplanned
things are happening all the time.

For example just two days ago Dr. Werner Fink of SuSE contacted me
again --- even with patch! --- for the UTF-8 input character set
detection he is longing for (for SuSE) for years, so we will *can*

   $ echo $'\u263A' > a.txt
   $ echo $'Hey \u263A' | \
 LC_ALL=C s-nail -:/ -Smta=test \
   -S ttycharset-detect=LATIN1 \
   -a a.txt -s Kn$'\366'del b...@exam.ple

via *ttycharset-detect* (please do not complain on names, if
i would start from scratch it would all be mime-*) in v14.10.
v14.10 should come out nicely without all the problems v14.9 had,
and it should definetely pave the way for the big MIME thing that
will end up as v15.

v14.10 will have many more tests, and a completely revised,
nonetheless extended manual.  For example, and note the test now
uses TAB not 3*SPC indentation,

  #?0|kent:s-nail-14.9.24$ ll nail.1 mx-test.sh; wc -cwlL mx-test.sh
  [.] 445611 Mar 26  2022 nail.1
  [.] 286616 Mar 26  2022 mx-test.sh*
   10597  38554 286616161 mx-test.sh

  #?0|kent:s-nail-14.9.24$ (cd ~/src/nail.git/;
ll nail.1 mx-test.sh; wc -cwlL mx-test.sh )
  [.] 387382 Jun 23 01:01 nail.1
^ and revision around ~70% iirc
  [.] 362323 Jun 23 01:01 mx-test.sh*
   14209  53479 362323388 mx-test.sh

In fact i was even thinking about v14.9.25 because 32 commits
cumulated on [master] since v14.9.24, with unfortunately some real
fixes.  But then i refrained, and keep on looking forward for
v14.10 of this little MUA.

Ciao, and a nice Summer, if you can!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] OAuth, and this little MUA, again

2023-04-26 Thread Steffen Nurpmeso
Just a quick notice on this, now regarding Google.

Now that i have bandwidth again i could reverify all accounts
i have, and some i had "reset" the oauth-helper.py configuration
of (ie removed refresh_token and access_token).

. Google
  It turned out that Google no longer allows flow=auth for
  authorization requests (at least not the first), so the _only_
  valid way of gaining authorization (the refresh_token) is via
  flow=redirect.  This seems to have happened in early 2023, said
  the error page to which i had been redirected.

  So: to authorize one needs flow=redirect (and remember that this
  starts an internal temporary HTTP server to which the browser
  redirects: they must run in the same namespace/container/etc),
  thereafter flow can be changed to flow=auth.

. Microsoft now works flawlessly (for me), they simply wanted the
  scope= to be transmitted each and every time (which contradicts
  their own RFC which documents this OAuth thing).  (flow=auth.)

. Yandex just works, but needs the documented lengthy setup.
  (I use devicecode for them.)

In short: i updated the --action=manual for all providers with the
above, and uploaded the resulting script to [1] again.  No other
changes.

  [1] https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

  Note: user "moon", password "mars", as in:

  $ curl -u moon:mars --basic -O 
https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

Ciao.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|~~
|..and in spring, hear David Leonard sing..
|
|The black bear,  The black bear,
|blithely holds his own   holds himself at leisure
|beating it, up and down  tossing over his ups and downs with pleasure
|~~
|Farewell, dear collar bear


Re: [S-mailx] mailx & oauth2

2023-04-18 Thread Steffen Nurpmeso
rb...@alumni.caltech.edu wrote in
 <202304181058.33iaweon006...@randytool.net>:
 | I can send my mail through a Microsoft Outlook domain with
 |sendmail.  I think sendmail is behind s-mailx.
 | I can't pick it up with fetchmail, but that's different.

Hello Mr. Bell.

#?0|kent:toolbox.git$ s-nail -Asitm
s-nail version v14.9.24-450-g9589f04a75.  Type `?' for help
/var/spool/mail/steffen: 0 messages
No more mail.
! Warning: --resource mode permissions other than user read/write: 0640: 
/home/steffen/sec.arena/mail/.sitm-ms.oauth
s-nail:  .. updating password to OAuth token 
#?0!0/NONE#|sitm:/var/spool/mail/steffen? short
shortcut imap %:imaps://outlook.office365.com
shortcut pop %:pop3s://outlook.office365.com
#?0!0/NONE#|sitm:/var/spool/mail/steffen? Fi imap
imaps://sugar.in.the.morning%40outlook@outlook.office365.com/INBOX: 4 
messages 4 new [Read-only]
#?0!0/NONE#|sitm:imaps://sugar.in.theoutlook@outlook.office365.com/INBOX?
  m rb...@alumni.caltech.edu
Subject: Hello Mr. Bell
...
!.
---
(Preliminary) Envelope contains:
Author: sugar.in.the.morn...@outlook.com
From: sugar.in.the.morn...@outlook.com
To: rb...@alumni.caltech.edu
Subject: Hello Mr. Bell
Send this message [yes/no, empty: recompose]? y

#?0!0/NONE#|sitm:imaps://sugar.in.theoutlook@outlook.office365.com/INBOX?
 Fi @Sent
#?0!0/NONE#|sitm:imaps://sugar.in.the0outlook@outlook.office365.com/Sent?
 h
...
 R4 To rb...@alumni.caltech.edu   2023-04-18 21:04  /  55371 Hello 
Mr. Bell
#?0!0/NONE#ERROR|sitm:imaps://sugar.in.the0outlook@outlook.office365.com/Sent?
 copy 4 /tmp/bigapple
/tmp/bigapple [NewNewNew] 776 bytes
#?0!0/NONE#ERROR|sitm:imaps://sugar.in.the0outlook@outlook.office365.com/Sent?
 Fi /tmp/bigapple
/tmp/bigapple: 1 message 1 new [Read-only]
▸R1 To rb...@alumni.caltech.edu   2023-04-18 21:0420/776 Hello 
Mr. Bell
#?0!0/NONE#ERROR|sitm:/tmp/bigapple? p
[-- Message  1 -- 20 lines, 776 bytes --]:
Date: Tue, 18 Apr 2023 21:04:38 +0200
Author: sugar.in.the.morn...@outlook.com
From: sugar.in.the.morn...@outlook.com
To: rb...@alumni.caltech.edu
Subject: Hello Mr. Bell
Message-ID: 

User-Agent: s-nail v14.9.24-450-g9589f04a75

Why not this little MUA?

#?0!0/NONE#ERROR|sitm:/tmp/bigapple?

 |russell bell
 --End of <202304181058.33iaweon006...@randytool.net>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-04-17 Thread Steffen Nurpmeso
Hello John,

(you are subscribed with your bigpond.com address, but i have set
this one free to post)

jwadod...@gmail.com wrote in
 <13ae2e249b4e8934ef720f31fc451ce5800048b1.ca...@gmail.com>:
 |Not sure if this is relevant, but I recently had trouble with the gnome
 |google auth & found that,
 |
 | /usr/libexec/goa-daemon --replace
 |
 |fixed the immediate problem.

I for myself hope i never have to use a full desktop environment
(again).  And can stay without systemd.  I really love to live on
the command line.  goa-daemon i do not know yet, does not exist on
CRUX Linux .. oh, it does exist on AlpineLinux, but if i look at
its dependencies i am a bit troubled i must say.  Not for me.
The thing with that email OAuth is that Microsoft produced that
RFC in 2012, but sometime after October last year they changed
their own implementation to be well why not say incompatible;
i had to read the entire 76 pages again to be very sure, however.
Google and Yandex worked just fine in October, and in March.
But for me personally this is only very occasional email usage,
you know.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-04-17 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <21561-1681760808-258...@sneakemail.com>:
 |On Mon, 17 Apr 2023, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> But client_secret is definetely not freely inventable by users,
 |> but if available is linked to the application.
 |> Alpine .. seems to have added an Outlook client_secret on
 |> 2020-07-09 with 0f89ad88df81df9d2ca7eafa276fecf8206fb598, and did
 |> not have one before.  Maybe with paying or something you can
 |> choose a longer validity than 30 months?  It passed the 30 months
 |> by now, that much is plain.
 |
 |The interval between alpine reauthorizations has definitely been less 
 |than 30 months.  More like 6, although I haven't tried to keep track. 
 |It's infrequent enough, and easy enough to do, that it isn't a problem.
 |
 |> you are the only person i know who sits
 |> "in some special department" that causes additional access checks
 |> to kick in.  And lucky that your own configuration works.
 |
 |Yes, I'm ok and not asking you to do anything for my sake at this point. 
 |I only replied to your message "for information".

Thank you Stephen.
Please wait ...

Ok, so i tried with Microsoft, and why oauth-helper.py looses the
refresh_token, but not the access_token.
It turns out that Microsoft change their policy, and, even though
totally out-of-standard RFC 6749, they now require the "scope" to
be passed around always.

I fixed that, and for me the Microsoft stuff works again
completely.  (They however strip "offline_access" from it, and we
faithfully take what they give us iirc.)  I am only a lonely user
and what do i know of your setup.  On the other hand bandwidth is
now totally borked, and with 64kbit none of the giants work today,
so OAuth login is almost impossible.  I hope it works.
 
Ciao.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-04-17 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <12083-1681687472-968...@sneakemail.com>:
 |On Sun, 16 Apr 2023, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> Stephen Isard wrote in
 |> <10085-1681666242-947...@sneakemail.com>:
 |>|I still get a message saying I need admin approval when I try to
 |>|authorize with your client id.  I think it must be a decision by the
 |>
 |> With the new script, aka after replacing the tenant=ID with
 |> tenant=common in the configuration, and refreshing it?
 |
 |With the new script and starting with an empty resourcefile

Ok.

 |...
 |> Hmmm, Alpine has a client_secret, whereas we have not; we only
 |> have an application/client ID, and Object ID, and
 |> a Directory/tenant ID, but which must not be used for real.
 |> I have not set a client secret, likely because that has a maximum
 |> lifetime, as i see (again).
 |
 |Well, alpine has asked me to reauthorize a couple of times since it has 
 |started using oauth.  I can't recall the intervals exactly, but several 
 |months at least.

They all do what they want about that --action=authorize.
But client_secret is definetely not freely inventable by users,
but if available is linked to the application.
Alpine .. seems to have added an Outlook client_secret on
2020-07-09 with 0f89ad88df81df9d2ca7eafa276fecf8206fb598, and did
not have one before.  Maybe with paying or something you can
choose a longer validity than 30 months?  It passed the 30 months
by now, that much is plain.

Well like i said, i am over my bandwidth limit until the 28th, and
then i had to ask you *again* to do testing when we have a client
secret, because it seems there is fine-grained access
differentiation going on, the rules of which are surely
documented somewhere, but you are the only person i know who sits
"in some special department" that causes additional access checks
to kick in.  And lucky that your own configuration works.
(Mysterious that i think the Mozilla ID then does not require
"administrator handwaving", even though it has tenant=common and
no client_secret (that i know of).)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-04-16 Thread Steffen Nurpmeso
Hello Stephen.

Ha-ha on a Sunday .. but only shortly..

Stephen Isard wrote in
 <10085-1681666242-947...@sneakemail.com>:
 |I still get a message saying I need admin approval when I try to 
 |authorize with your client id.  I think it must be a decision by the 

With the new script, aka after replacing the tenant=ID with
tenant=common in the configuration, and refreshing it?

 |organization that outsourced me to Microsoft, rather than Microsoft 
 |itself.  Microsoft sends me to log in to my organization account and it 
 |is only after logging in that I get that message.
 |
 |As I've said, I am ok if I use the client id for s-nail that I created 
 |for myself while logged in on Microsoft Azure with my organization 
 |credentials.
 |
 |This all sounds like standard irritating organizational behaviour.  The 
 |only puzzle is why I don't have similar problems authorizing alpine, 
 |another non-Microsoft mua.

That is the thing that i do not understand then, too.
Hmmm, Alpine has a client_secret, whereas we have not; we only
have an application/client ID, and Object ID, and
a Directory/tenant ID, but which must not be used for real.
I have not set a client secret, likely because that has a maximum
lifetime, as i see (again).
I am totally out of bandwidth so playing around with browsers is
risky until the 28th, and i want to release a new s-postgray on
the 19th..
Great you have a working ID and still use this MUA sometimes!!

Ciao from Germany!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-04-15 Thread Steffen Nurpmeso
Hello list, hello Stephen.

A follow-up to this.  As some may remember, the S-nail/s-mailx
application stopped working via OAuth, that is, IMAP was possible,
but sending via SMTP caused only failed authentications.

It magically works again: i took part in a thread on mutt-dev@,
and it was Ian Collier of Oxford University who dropped the word
about "common instead of tenant ID".

Now, whereas our oauth-helper.py script itself uses "tenant=common" for
Microsoft, the registered S-nail (s-mailx) application instead uses
the generated tenant ID, and it worked like that back in last
October.
Interestingly refresh_token is now totally missing, outlook.com
only manages access_token .. currently.  But hey -- it works!

So i updated the manual in the script, and the S-nail/s-mailx
config itself, to be downloaded at will from [1].

Ciao from Germany, and a nice rest-Sunday!

  [1] https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py
  Note: user "moon", password "mars", as in:
  $ curl -u moon:mars --basic -O 
https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-03-16 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <14350-1678979414-364...@sneakemail.com>:
 |On Thu, 16 Mar 2023, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> (The instructions are included in oauth-helper.py via action=manual
 |> provider=Microsoft.  And oh i see -- this should not be enabled by
 |> default, maybe someone misused that ID for bad things, and now
 |> Microsoft has disabled?  But .. i can login via IMAP, POP3
 |> protocols does not exist anyhow, and SMTP is rejected with
 |> unauthorized.)
 |
 |On the remote machine that I am testing with, I have to set 'from' to my 
 |login name at the organization.  If I set it to my email address at the 
 |organization, which is different, I get an error message.  Could that be 
 |the same problem that you are having?

No.  IMAP is ok

  s-nail: >>> SERVER: T2 OK AUTHENTICATE completed.

POP3 is non-existent

  s-nail: >>> SERVER: -ERR Protocol error. Connection is closed. 10

SMTP cannot be used

  s-nail: >>> SERVER: 535 5.7.3 Authentication unsuccessful 
[FR2P281CA0126.DEUP281.PROD.OUTLOOK.COM 2023-03-16T21:53:47.593Z 
08DB25FCA979DAD0]

regardless of with smtp-from (development branch), hostname, or
not.  from is n...@outlook.com, that is needed of course for From:
header?

  From: fozzi-b...@outlook.com
  s-nail: >>> MAIL FROM: BODY=7BIT

smtp-from came in so that it is not @outlook@outlook.com.
Well i mean i just retried once more with Yandex (IMAP, SMTP) and
Gmail (IMAP, POP3, SMTP), and all that works just fine.

And i really have changed nothing since September when it worked
flawlessly.  And refreshing the token updates the scope= like

  scope=https://outlook.office.com/IMAP.AccessAsUser.All 
https://outlook.office.com/POP.AccessAsUser.All 
https://outlook.office.com/SMTP.Send

(we save it 1:1 just as we get it back from Microsoft).
So if oauth-helper.py works for you (i just pushed a fix for
the new --automatic ;() then i presume it is the tenant=.
By the way the portal.azure.com "API permissions" screen shows
"No" for "Admin consent required" for all permissions of s-mailx?

Such a mess!
I cannot help it -- if it works for you, then .. maybe i should
recreate the application?  But then again, i am sick of it.
May Microsoft mess in peace for now.

Thanks, Stephen.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-03-15 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <6916-1678924548-25...@sneakemail.com>:
 |On Wed, 15 Mar 2023, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> So i would assume you are using that "department tenant" and
 |> client ID like you did last September, and not the "s-mailx"
 |> "application"?
 |
 |I am using the client id that I set up for myself, following the 
 |instructions that you pointed me at.  I think that they were from the 
 |mutt website.  I believe that you were able to connect using that client 
 |id as well.  I have just tried
 |/s-nail-oauth-helper.py -a authorize -p Microsoft -R resourcefile
 |where resourcefile came from running
 |s-nail-oauth-helper.py -p Microsoft -a template -R resourcefile
 |
 |This was on a machine that I was logged in on remotely via ssh, so I 
 |changed flow from redirect to devicecode.  Everything went ok until I 
 |was asked to log in to my organization's website.  When I did that, I 
 |was told that s-nail was not trusted and I would need permission from 
 |some higher authority.  I don't get that if I use my own client id 
 |instead of the one that s-nail-oauth-helper.py puts into the 
 |resourcefile.

Thanks for checking this.

(The instructions are included in oauth-helper.py via action=manual
provider=Microsoft.  And oh i see -- this should not be enabled by
default, maybe someone misused that ID for bad things, and now
Microsoft has disabled?  But .. i can login via IMAP, POP3
protocols does not exist anyhow, and SMTP is rejected with
unauthorized.)

Well maybe i have to re-setup that app.  I put some more time.

Ciao, and good night!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-03-15 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <27742-1678839459-662...@sneakemail.com>:
 |On Tue, 14 Mar 2023, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> Is anybody using the oauth-helper.py with Microsoft?
 |
 |Sorry for the delay in responding.  I'm using oauth with Microsoft, but 

All on my side.  Thanks for answering.

 |after you taught me enough to make it work with the mutt oauth script
 |mutt_oauth2.py, I never converted to your (much superior) script, 
 |because I had a working setup and didn't want to disturb it.

Like the ballad of John and Yoko, another Apple Records
production.  Sigh.

 |My account definition includes the lines
 |set mta=submission://smtp.office365.com
 |set smtp-auth=oauthbearer
 |and I can send mail.

So i would assume you are using that "department tenant" and
client ID like you did last September, and not the "s-mailx"
"application"?

I would then conclude that during some work they "did
something" on all those dumb / gratis / few users / petty Azure
applications like "s-mailx" without even notifying their owners.
IMAP login and anything works, SMTP does not.

Thanks.
And Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-03-15 Thread Steffen Nurpmeso
Hello.

Steffen Nurpmeso wrote in
 <20230314223059.awkol%stef...@sdaoden.eu>:
 |Steffen Nurpmeso wrote in
 | <20230314213206.paznm%stef...@sdaoden.eu>:
 ||Is anybody using the oauth-helper.py with Microsoft?
 | ...
 ||I am in the process of extending oauth-helper.py so that this can
 ||be automatized a bit (currently it fails hard because that
 | ...
 |
 |Now on [1]: instead of hard-failing for the no longer supported
 |access token refresh (i cannot believe this is really true), we
 |will now restart ourselfs to authorize.
 |Also a new configuration option "refresh_needs_authorize=y" (any
 |non-empty value) will forcefully skip over the useless try to
 |refresh the token.

To make this really work i have also added the -A / --automatic
option, so that we forcefully fail if interactivity would be
required.  (Also the --help output now fits in 25 lines.)

 |  [1] https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py
 |
 |  Note: user "moon", password "mars", as in:
 |
 |  $ curl -u moon:mars --basic -O https://git.sdaoden.eu/browse/s-toolbo\
 |  x.git/plain/oauth-helper.py

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth, and Microsoft, and this little MUA

2023-03-14 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20230314213206.paznm%stef...@sdaoden.eu>:
 |Hello list.
 |
 |Is anybody using the oauth-helper.py with Microsoft?
 ...
 |I am in the process of extending oauth-helper.py so that this can
 |be automatized a bit (currently it fails hard because that
 ...

Now on [1]: instead of hard-failing for the no longer supported
access token refresh (i cannot believe this is really true), we
will now restart ourselfs to authorize.
Also a new configuration option "refresh_needs_authorize=y" (any
non-empty value) will forcefully skip over the useless try to
refresh the token.

  [1] https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

  Note: user "moon", password "mars", as in:

  $ curl -u moon:mars --basic -O 
https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

I would be happy if someone could tell me how to re-enable SMTP,
or point out what i am doing wrong.

Ciao.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] OAuth, and Microsoft, and this little MUA

2023-03-14 Thread Steffen Nurpmeso
Hello list.

Is anybody using the oauth-helper.py with Microsoft?

For a test i activated all of my GMail, Yandex and Microsoft
accounts yesterday, and the OAuth password had to be renewed.
This worked flawlessly except for Microsoft, which failed

  OAuth 2.0 RFC 6749, 6.  Refreshing an Access Token

but wanted the non-automatic

  OAuth 2.0 RFC 6749, 4.1.1. Authorization Request

instead; i presume this is due to their "passwordless" stuff, of
which i know nothing.
This took some time (below) and was not finished.
This afternoon again, so it seems they now _always_ require an
authorization instead of only a normal refresh.  (After 3600
seconds.)  What a mess, what a burden.

I am in the process of extending oauth-helper.py so that this can
be automatized a bit (currently it fails hard because that
the standardized access token refresh is rejected is not on the
plan).

But .. furthermore.  Is anyone using such an OAuth token with
Microsoft successfully?  I am back where i was in the past, i can
login and work via IMAP, but i am not allowed to send mails via
SMTP!  I have changed nothing for the "s-mailx" application that
oauth-helper.py ships with, and my configuration is not changed
either, but IMAP works, SMTP does not.  I have re-verified the
settings in the Azure portal, but to no avail.

So the question -- can anyone send via Microsoft and SMTP and
OAuth with this little MUA?  Stephen?

Thank you, and Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] How download attachment of incoming mail?

2023-02-27 Thread Steffen Nurpmeso
Hello Hariskar.

Χάρης Καραχριστιανίδης wrote in
 <20230227163854.2hwrw%haris...@otenet.gr>:
 |I received an email with a *.fit attachment. 2 problems: How can I \
 |download it? Ans 2nd when I open the mail with next mailx tries to \
 |read the attachment:

You want to `write' it out?

 In interactive mode the user is consecutively asked for the
 filenames of the processed parts.  For convenience saving of
 each part may be skipped by giving an empty value, the same re‐
 sult as writing it to /dev/null[647].  Shell piping the part
 content by specifying a leading vertical bar ‘|’ character for
 the filename is supported.  Other user input undergoes the
 usual Filename transformations[27], including shell pathname
 wildcard pattern expansions (glob(7)[710]) and shell variable
 expansion for the message as such, not the individual parts,
 and contents of the destination file are overwritten if the
 file previously existed.  Character set conversion to
 ttycharset[602] is performed when saving text data.

And 2nd i .. do not understand, the .fit mimetype is not built-in
(xml has no more ?h `mimetype' type-marker because of what you
say, too).
Well i do not know, is it covered by your ~/.mailcap somwhow?

 |
 ...

Should not be shown per se i would say.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] w3m default in .mailcap for plain and html text, lynx still called

2023-02-25 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230225153045.x5sns%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 ...
 |>|lynx is called form /etc/mailcap which is not overriden from ~/.mailcap..
 |> 
 |> Mailcap files are searched in $MAILCAPS order:
 |> 
 |>   ? varshow MAILCAPS
 |>   set MAILCAPS=~/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/ma\
 |>   ilcap
 |> 
 |> So your personal file should be matched first.  (You could
 |> override this if you need to.)
 |> 
 |>   ? mailcap
 ...
 |In /etc/mailcap I commented out
 |text/html; lynx -dump -assume_charset=%{charset} %s; copiousoutput; \
 |description=HTML Text; nametemplate=%s.html

 |and in ~/.maicap I added

 |text/html; w3m -H -T text/html %s; needsterminal; description=HTML \
 |Text; nametemplate=%s.html
 |text/html; w3m -H -dump -T text/html %s; copiousoutput; description=HTML \
 |Text; nametemplate=%s.html

 |and everything, icluding Greek works fine!

Nice.. but it sounds a bit odd to me because your ~/.mailcap comes
first so whatever is in /etc/mailcap should be inspected as
a second class citizen, and to be absolutely sure (just in case my
code inspection is borked) i have even tried it.


But hey!
In the meantime i had a conscious moment and fixed this terrible
bug in the mailcap %{NAME} format expansion!  With credits to you!

On master and the stable branches; the according test is on the
development branch only.  v14.10 will come with a much improved
test coverage, but that .. we yet had not.

No easy way out for you, except maybe doing someting like

  text/html;\
cs=%{charset}\;\
cs=${cs%*'charset}'}\;\
lynx -dump -assume_charset=$cs %s; copiousoutput

etc (not tried but in shell).

AARGH!!

Thanks and ciao!  Greetings to Greece!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] w3m default in .mailcap for plain and html text, lynx still called

2023-02-25 Thread Steffen Nurpmeso
Hello Hariskar.

(Just quick note, be back in a few hours..)

Χάρης Καραχριστιανίδης wrote in
 <20230225132925.igpgb%haris...@otenet.gr>:
 |Χάρης Καραχριστιανίδης  wrote:
 |> lynx doesn't recognise Greek iso-8859-7 characters whatever options \
 |> I tried (assume_charset, assume_local_charset, assume_unrec_charset) \
 |> so I installed w3m (it shows Greek characters) and uninstalled lynx. \
 |> I put in .mailcap:

 |> text/html; w3m -H %s; nametemplate=%s.html
 |> text/plain; w3m -H %s

 |> Most of emails open in less but when I try to open some of them they \
 |> don't open and this message appears:

 |> s-nail: Forking child with spawn control: /bin/bash -c $'lynx -dump \
 |> -assume_charset=\'UTF-8\'charset} "${MAILX_FILENAME_TEMPORARY}"'
 |> /bin/bash: line 1: lynx: command not found
 |> 
 |> I have no relevant setting in .mailrc. Why is lynx called? How can \
 |> I make w3m be called for this (or how can I make lynx read Greek \
 |> iso-8859-7 characters?)

Should show you the actually used cache.
In general (as per manual section "HTML mail and MIME
attachments") the lookup order is pipe-EXTENSION,
pipe-TYPE/SUBTYPE, mailcaps, mimetype type-markers.
Maybe you still have a pipe-text/html thing set?

 |lynx is called form /etc/mailcap which is not overriden from ~/.mailcap..

Mailcap files are searched in $MAILCAPS order:

  ? varshow MAILCAPS
  set MAILCAPS=~/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap

So your personal file should be matched first.  (You could
override this if you need to.)

  ? mailcap

 --End of <20230225132925.igpgb%haris...@otenet.gr>

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bogofilter wuestion

2023-02-21 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20230221173236.ulzv1%stef...@sdaoden.eu>:
 |Χάρης Καραχριστιανίδης wrote in
 | <20230221033050.uf_w5%haris...@otenet.gr>:
 | ...
 ||Thank you, my problem is that even emails that I define as spam with \
 ||spamspam have score 0.00 (as all other mail).. I trained bogofilyrt \
 ||with about 450 emails till now which I marked as spamham (most of then \
 ||and a few as spamspam). Does it need more training to show ratings \
 ||other than 0.00?
 |
 |Then yes.  :-)

The thing is Bayes counts words.  It is pretty primitive.
And usually nothing is wrong with words like mastu***tion or such,
in fact it is pretty natural for at least the human species, but
in some context it may be (super annoying or disgusting) spam.

This is in fact why i removed the Heirloom spam code, even though
it has its merits (word anonymization for example).  Because now
you can use whatever you want, and exchange the DBs that were
trained over a long time in between whoever needs a trained Bayes
spam checker.
In real life i expect noone except myself to use this MUA alone.
(Some old hands keep using Heirloom though; one aspect could
surely be that they loose a trained Bayes.)

Ciao, Hariskar!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bogofilter does not change spam score

2023-02-21 Thread Steffen Nurpmeso
Hello Hariskar.

Χάρης Καραχριστιανίδης wrote in
 <20230221150608.psjak%haris...@otenet.gr>:
 |Χάρης Καραχριστιανίδης  wrote:
 |> Χάρης Καραχριστιανίδης  wrote:
 |>> Although I have trained it (spamspam, spamham) with about 500 emails, \
 |>> a few spam and most of them ham the spam score is always 0.00.
 |>> Should it need more training? I put these additions to .mailrc, \
 |>> are they correct? Any advice?
 |>> 
 |>> set spam-interface=filter
 |>> set spam-maxsize=50
 |>> set spamfilter-ham="bogofilter -n"
 |>> set spamfilter-noham="bogofilter -N"
 |>> set spamfilter-nospam="bogofilter -S"
 |>> set spamfilter-rate="bogofilter -TTu 2>/dev/null"
 |>> set spamfilter-spam="bogofilter -s"
 |>> set spamfilter-rate-scanscore="1;^(.+)$"
 |>> set headline='%>%a%m%$ %-20f %16d %4l/%-5o %i%-s'
 |>> 
 |>> $ bogofilter -V
 |>> bogofilter-sqlite version 1.2.5
 |>> Database: SQLite 3.40.1

Slower and larger entries.  But can VACUUM i think.

 |> I just saw that in header there is spam entry it just doess not show \
 |> in header rummary.
 |> 
 |> ? show X
 |> X-Spam-Flag: NO
 |> X-Spam-Score: 3.248
 |> X-Spam-Level: ***
 |> X-Spam-Status: No, score=3.248 tagged_above=0.001 required=8
 |
 |but not all mails have this part in their header. Maybe those that \
 |have it are marked from sender? Or ISP?

This is upstream, S-nail only reacts on the spamscore.  Messages
are not (yet) modified to include some spamcheck result headers.

It will happen somewhen.  The more it learns the better.
Especially spam, of course.  Not ham.  Decades ago there was
somewhere a box on the web with i think many many many thousand
spam message, i think 150.000 .. i cannot find it.

Bayes spam filtering is a simple thing.  But for me it is
very well sufficient, i only do "S" or "H" fewest times a week.

 --End of <20230221150608.psjak%haris...@otenet.gr>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bogofilter wuestion

2023-02-21 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230221033050.uf_w5%haris...@otenet.gr>:
 ...
 |Thank you, my problem is that even emails that I define as spam with \
 |spamspam have score 0.00 (as all other mail).. I trained bogofilyrt \
 |with about 450 emails till now which I marked as spamham (most of then \
 |and a few as spamspam). Does it need more training to show ratings \
 |other than 0.00?

Then yes.  :-)

 --End of <20230221033050.uf_w5%haris...@otenet.gr>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bogofilter wuestion

2023-02-20 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20230220191015.bby4z%stef...@sdaoden.eu>:
 |Χάρης Καραχριστιανίδης wrote in
 | <20230220184916.javb0%haris...@otenet.gr>:
 ||Steffen Nurpmeso  wrote:
 | ...
 ||>|> I installed bogofilter and put these lines in .mailrc.
 | ...
 ||>|> ? spamrate 1-31
 | ...
 ||Thank you! Is it a problem that I use imap? Inbox is imap. Manual says \
 ||it has to be stored localy for spam lookup.//
 |
 |We do download it all in order to do the spam check.
 |(If not that would be a bug.  .. Does not seem to be one?)


You can use IMAP search expressions to match for simple "shit" on
the server, move it away, then spamrate the rest locally.
To make local teaching easier i have

  commandalias H spamham
  commandalias S spamspam

I almost never have to use this no more.  (Even a key-binding
could be used today, to make it even easier!)

For example, i download my mail via SSH like this (this is v14.10
so it will not work 1:1 on v14.9.24; on the server s-nail is
v14.9.24, and was even older for long, no -Y..; an excerpt only):

  define load-sdaoden.eu {
\local set noheader
\!exec ssh stef...@vpn.sdaoden.eu "\
{ \
{ \
echo 'move \"@f@FedEx|lottery\" \
\"@OBORON|\\[SPAM|Voice Message|\
beloved|business|charity|dear 
friend|darlehen|donation|\

investment|kredit|loan|payment|urgent|voicemail|\

masturb|pädophi|pedophil|porn\" \

\"@^[[:space:]]*((hello|hi|re|reply|yo):?[[:space:]]*\
  (there[[:space:]]*)?)?\$\" \
~/spam.mbox';\
\
echo 'move * ~/download.mbox'; \
} |\
mail -:/ -#f %:/var/spool/mail/steffen; \
} >/dev/null 2>&1 &&\
\
if [ -s ~/download.mbox ]; then \
cat ~/download.mbox &&\
rm ~/download.mbox;\
fi\
" >> ~/sec.arena/mail/download
\fi+download
\h
\spamr:n
\sea:s
\mov ` /var/tmp/${LOGNAME}/traffic/.spam~
\sea:n
  }

But something similar is doable with IMAP search expressions,
which are executed on the server.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bogofilter wuestion

2023-02-20 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230220184916.javb0%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 ...
 |>|> I installed bogofilter and put these lines in .mailrc.
 ...
 |>|> ? spamrate 1-31
 ...
 |Thank you! Is it a problem that I use imap? Inbox is imap. Manual says \
 |it has to be stored localy for spam lookup.//

We do download it all in order to do the spam check.
(If not that would be a bug.  .. Does not seem to be one?)

 --End of <20230220184916.javb0%haris...@otenet.gr>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bogofilter wuestion

2023-02-20 Thread Steffen Nurpmeso
Hello Hariskar.

Χάρης Καραχριστιανίδης wrote in
 <20230220150942.kdkma%haris...@otenet.gr>:
 |Χάρης Καραχριστιανίδης  wrote:
 |
 |> I installed bogofilter and put these lines in .mailrc.
 |> set spam-interface=filter
 |> set spam-maxsize=50
 |> set spamfilter-ham="bogofilter -n"
 |> set spamfilter-noham="bogofilter -N"
 |> set spamfilter-nospam="bogofilter -S"
 |> set spamfilter-rate="bogofilter -TTu 2>/dev/null"
 |> set spamfilter-spam="bogofilter -s"
 |> set spamfilter-rate-scanscore="1;^(.+)$"

This is ok.

 |> set headline='%>%a%m%$ %-18f %16d %4l/%-5o %i%-s'
 |> 
 |> With:
 |> ? spamrate 1-31
 |> I get
 |> spamrate:.31  1/30 done (31/0 all/skipped)
 |> 
 |> and nothing changes in emails spam rate, all are 0.00.
 |> 
 |> If I run
 |> ? spamspam 28
 |> nothing changes again.
 |> Any help please?
 |Subject should be "bogofilter question" ...

bogofilter needs to be learned in order to be able to produce
results.  This takes quite a while, but if i recall correctly
results improve fast.  On the other hand some things will never
work out.  My DB is

  #?0|kent:steffen$ ll /var/tmp/steffen/.bogofilter/wordlist.lmdb
  -rw-r- 1 steffen steffen 498155520 Feb 20 19:36 
/var/tmp/steffen/.bogofilter/wordlist.lmdb

but this LMDB which does not have some kind of VACUUM and
therefore needs to be dumped / restored to get rid of cruft, i do
that once a month.  The monthly backup is

  $ ll ~/sec.arena/backups/spam.db.zst
  -rw-r- 1 steffen steffen 77287246 Jan 28 19:14 
/home/steffen/sec.arena/backups/spam.db.zst

and it decompresses to a file of 255850825 bytes.

SpamAssassin may be the better option if you do not have a DB as
it has built-in things to look out for (if i recall correctly).

 --End of <20230220150942.kdkma%haris...@otenet.gr>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Colours colour only a few of my headers

2023-02-18 Thread Steffen Nurpmeso
Hello Hariskar.

Χάρης Καραχριστιανίδης wrote in
 <20230218195225.puiah%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230218164345.ake5b%haris...@otenet.gr>:
 |>|Steffen Nurpmeso  wrote:
 ...
 |> Ah!  Sorry Hariskar, you need "set colour-pager"!
 |> 
 |> This is long obsolete here, in v14.10 the variable does nothing:
 |> you have to "set colour-disable" or not use colours at all.
 ...
 |With "set colour-pager" colors work fine on every email!
 |Will that not work in next versions? Will there be another solution \
 |for colour?

It is implied here.  (Assuming that _if_ you want colour, you
surely want it in the $PAGER also.)

Ciao!  And a nice Sunday i wish!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Colours colour only a few of my headers

2023-02-18 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230218164345.ake5b%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 
 |>|I have no srt set. With crt=20 no colour at all. It seems that when \
 |>|less opens there is no colour and when it doesn't open there is colour?
 |> 
 |> You seem to have the $LESS environment variable set.
 |> There is a note on that for $PAGER:
 ...
 |> You surely need -R (there was a security advisory regarding that,
 |> less should be >= 608) in $LESS for colours, if you set it
 |> yourself.  I have
 |> 
 |>   #?0|kent:tmp$ echo $LESS
 |>   -IFe
 |>   #?0|kent:tmp$ alias v
 |>   alias v='LESS= less -RIFe'
 ...
 |Is seems I already have -R?
 |
 |$ echo $LESS
 |-R -M --shift 5

Ah!  Sorry Hariskar, you need "set colour-pager"!

This is long obsolete here, in v14.10 the variable does nothing:
you have to "set colour-disable" or not use colours at all.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-18 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230218162804._hs8u%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 ...
 |> Unfortunately commandalias, alias, shortcut, bind, colours etc etc
 |> are all not yet covered by "local"(opts), so that you really have
 |> to overwrite the things again when you switch off.
 |> I often use the on-account-cleanup hook for that, so that i am
 ...
 |>   define oac {
 |> uncommandalias oi os mi
 |> unshortcut imap
 |>}
 ...
 |>   set on-account-cleanup=oac
 ...
 |Is define oac really needed? I have shortcuts that are different between \
 |the 2 accounts and shortcuts that are same, but they are shoertcuts \
 |for the exact same thing in both accounts.

Whatever you want, hari!

 |PS1 As you may have noticed I learned the ~e function!

I have (i use "set escape=!")

  bind compose :kf1 !v
  bind compose :kf2 !p

 |PS2 I uninstalled mutt today!

Oh .. if that wasn't a bit early!  There is so much which is very
complicated to do with s-nail, if at all, what mutt can easily do.

 |PS3 Thank you for this great program!!

Thank you in return.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-18 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230218160854.mdavc%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230218125916.ofb__%haris...@otenet.gr>:
 |>|Steffen Nurpmeso  wrote:
 |>|> Χάρης Καραχριστιανίδης wrote in
 |>|>  <20230217184829.j1piy%haris...@otenet.gr>:
 |>|>|Steffen Nurpmeso  wrote:
 |>|>|> Χάρης Καραχριστιανίδης wrote in
 |>|>|>  <20230217133009.z4nty%haris...@otenet.gr>:
 |>|>|>|Steffen Nurpmeso  wrote:
 |>|>|>|> Χάρης Καραχριστιανίδης wrote in
 |>|>|>|>  <20230216081131.myqru%haris...@otenet.gr>:
 |>|>|>|>|Steffen Nurpmeso  wrote:
 |>|>|>|>|> Χάρης Καραχριστιανίδης wrote in
 |>  ...
 |>|Here is my .mailrc after following your suggestions (I think). Much \
 |>|smaller and cleaner! Could some options go out of the 2 accounts and \
 |>|put them before the accounts? Like set smtp-use-starttls or set imap-kee\
 |>|palive=240
 |>|   set imap-cache=~/.mail/.imap_cache ?
 |> 
 |> Sure.  Like you do with netrc-lookup.  (Which i only set
 |> per-account).
 |> 
 |>|set v15-compat=y
 |>|set netrc-lookup
 |>|
 |>|set mime-alternative-favour-rich
 |>|set pipe-text/html='?! lynx -stdin -force_html'
 |> 
 |> And you do use the built-in HTML filter for simple overview, that
 |> only for "mimeview".  Ok.
 |
 |Would you suggest to use lynx also for simple overview?

I personally use the built-in filter.  I almost never feel the
need to really go HTML, but if, i use copy+paste (my graphical web
browser runs in a box, i mean, ok, that could be done from mailcap
or whatever, but, well..)
"Normally" people really want the "copiousoutput" variant and look
at the HTML inline, aka via "lynx -dump".  I even do so for PDF,
pdftotext.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-18 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20230218152915.ewsrx%stef...@sdaoden.eu>:
 |Χάρης Καραχριστιανίδης wrote in
 | <20230218125916.ofb__%haris...@otenet.gr>:
 ||Steffen Nurpmeso  wrote:
 ||> Χάρης Καραχριστιανίδης wrote in
 ||>  <20230217184829.j1piy%haris...@otenet.gr>:
 ||>|Steffen Nurpmeso  wrote:
 ||>|> Χάρης Καραχριστιανίδης wrote in
 ||>|>  <20230217133009.z4nty%haris...@otenet.gr>:
 ||>|>|Steffen Nurpmeso  wrote:
 ||>|>|> Χάρης Καραχριστιανίδης wrote in
 ||>|>|>  <20230216081131.myqru%haris...@otenet.gr>:
 ||>|>|>|Steffen Nurpmeso  wrote:
 ||>|>|>|> Χάρης Καραχριστιανίδης wrote in
 ...
 ||Here is my .mailrc after following your suggestions (I think). Much \
 ||smaller and cleaner! Could some options go out of the 2 accounts and \
 ||put them before the accounts? Like set smtp-use-starttls or set imap-kee\
 ||palive=240
 ||   set imap-cache=~/.mail/.imap_cache ?
 |
 |Sure.  Like you do with netrc-lookup.  (Which i only set
 |per-account).

P.S.: the latter is a false statement.
(I had that wrong; in fact i only have one remaining use case for
.netrc after so many enforce OAuth, i have switched all GMail,
Microsoft and Yandex accounts to go via OAuth.  I do not use them
much but for testing, anyway, and anymore.)

Ciao.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-18 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230218125916.ofb__%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230217184829.j1piy%haris...@otenet.gr>:
 |>|Steffen Nurpmeso  wrote:
 |>|> Χάρης Καραχριστιανίδης wrote in
 |>|>  <20230217133009.z4nty%haris...@otenet.gr>:
 |>|>|Steffen Nurpmeso  wrote:
 |>|>|> Χάρης Καραχριστιανίδης wrote in
 |>|>|>  <20230216081131.myqru%haris...@otenet.gr>:
 |>|>|>|Steffen Nurpmeso  wrote:
 |>|>|>|> Χάρης Καραχριστιανίδης wrote in
 ...
 |Here is my .mailrc after following your suggestions (I think). Much \
 |smaller and cleaner! Could some options go out of the 2 accounts and \
 |put them before the accounts? Like set smtp-use-starttls or set imap-kee\
 |palive=240
 |   set imap-cache=~/.mail/.imap_cache ?

Sure.  Like you do with netrc-lookup.  (Which i only set
per-account).

 |set v15-compat=y
 |set netrc-lookup
 |
 |set mime-alternative-favour-rich
 |set pipe-text/html='?! lynx -stdin -force_html'

And you do use the built-in HTML filter for simple overview, that
only for "mimeview".  Ok.  You could then move this to your
~/.mailcap file, no?  You could remove the duplicate "mupdf" from
it and instead add a "text/html; lynx %s; nametemplate=%s.html".

 |colour 256 view-header ft=bold,fg=111 subject,from
 |colour 256 view-partinfo fg=2
 |colour 256 view-msginfo fg=1
 |#colour 256 sum-dotmark   fg=204,ft=bold dot
 |#colour 256 sum-headerfg=39 older
 |#colour 256 sum-headerfg=39,ft=reverse dot
 |#colour 256 sum-headerfg=45
 |colour 256 sum-threadfg=39,ft=bold,ft=reverse dot
 |colour 256 sum-threadfg=172
 |colour 256 view-from_fg=142
 |#colour 256 view-header   fg=214,ft=bold from,subject
 |colour 256 view-header   fg=214 author,cc,sender,to
 |colour 256 view-header   fg=217 reply-to,mail-followup-to,user-agent
 |colour 256 view-header   fg=219
 |#colour 256 view-msginfo  fg=76,ft=bold
 |#colour 256 view-partinfo fg=76
 |#colour 256 mle-position  fg=203,ft=reverse
 |#colour 256 mle-promptfg=203
 |#colour 256 mle-error bg=124
 |
 |
 |
 |account account1 {
 |   set smtp-use-starttls

Yes make it global, v14.10 will bring smtp-config instead and TLS
is implied (must be turned off explicitly).

 |   set mta=smtp://mailgate.xx.xx
 |   set from="x xxx "
 |   set record=@Sent
 |   set inbox=imaps://imap.xx.xx:993
 |   set imap-keepalive=240
 |   set imap-cache=~/.mail/.imap_cache
 |   commandalias oi 'account account1'
 |   commandalias os 'fi @Sent'

I for example have

  bind default :kf5 Fi+sent

so that pressing F5 goes to the sent folder, readonly.  (I usually
do not want to modify the sent folder.)
Unfortunately commandalias, alias, shortcut, bind, colours etc etc
are all not yet covered by "local"(opts), so that you really have
to overwrite the things again when you switch off.
I often use the on-account-cleanup hook for that, so that i am
sure all account-specifics are gone in the "global namespace"
/ other accounts, but i look forward to get that implemented,
finally.  (Not v14.10 most likely, though.  Unfortunately.)

  define oac {
uncommandalias oi os mi
unshortcut imap
  }

Local "define"s (aka in other macros) is also not yet supported.

 |   commandalias mi 'account account2'

  set on-account-cleanup=oac
 |}
 |
 |account account2 {
 |   set smtp-use-starttls
 |   set mta=smtp://mail.x.xx
 |   set from="x xxxν "
 |   set message-inject-tail=$'\n--- \nXX  \nX XX\
 |   XX \n XX XX XXX XXX XXX \
 |   '
 |   set record=@Sent
 |   set inbox=imaps://mail.xx.xx:993
 |   set imap-keepalive=240
 |   set imap--cache=~/.mail/.imap_cache

Typo?  Note that the imap-cache will definetely vanish not to come
back.  There will be a header cache, aka "mail summary files", as
shown by Jamie Zawinski for Netscape, a quarter of a century ago.
Yes, connect / disconnect will vanish, you switch on and off
a mailbox, and after connection breaks reconnection will be
automatic.  (The latter maybe already with v14.10, if i get a go.)

 |   shortcut imap imaps://mail..xx:993
 |   commandalias mi 'account account2'
 |   commandalias ms 'fi @Sent'
 |   commandalias oi 'account account1'
 |}
 |
 |alias x1 x...@xx.xx
 |alias dk zz...@z.zz

Well it looks quite ok i would say.

 --End of <20230218125916.ofb__%haris...@otenet.gr>

Ciao, and a nice weekend i wish.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Colours colour only a few of my headers

2023-02-18 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230218103017.wj41n%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230217201526.h5ogc%haris...@otenet.gr>:
 |>|Steffen Nurpmeso  wrote:
 |>|> Χάρης Καραχριστιανίδης wrote in
 |>|>  <20230217191546.bzynv%haris...@otenet.gr>:
 |>|>|Only headers that begin after previous mail or header summary are \
 |>|>|colour\
 |>|>|ed. Headers that are on the top of the page or in the middle of an \
 |>|>|empty page are not coloured. Shouldn'e the behaviour be the same for \
 |>|>|all headers?
 |>  ...
 |>|> No, content cannot be coloured yet.  And this will require v15
 |>  ...
 |>|Sorry page is the wrong word, screen is the dorrect work in my previous \
 |>|email.
 |>|I am not talking about the body of emails but about each email header. \
 |>|The header of most of my emails is not coloured depending on conditions \
 |>|I described. I can send you photos.
 |> 
 |> You actually have found a _horrifying_bug_!
 ...
 |> Please ensure that only non-empty "preconditions" are used (ie
 |> dot, and the header names in your config), please simply leave off
 |> empty ones.  Like so
 ...
 |>   colour 256 sum-threadfg=172
 ...
 |> (instead of eg "colour 256 view-header   fg=219 ''").
  ...

 |It is just s very small bug in a great program!

If it were like that.  I am on v14.10 for three years, so many
things were fixed; i hope that can be released before summer.

 |I ensure that I don't use colour like "colour 256 view-header   fg=219 \
 |''" but I use "colour 256 view-header   fg=219"

Hm.

 |I have no srt set. With crt=20 no colour at all. It seems that when \
 |less opens there is no colour and when it doesn't open there is colour?

You seem to have the $LESS environment variable set.
There is a note on that for $PAGER:

  The content of this variable is inspected: if it contains
^ $PAGER
  "less" then a non-existing environment variable LESS is tem-
  porarily set to the portable 'RIFE' (the latter two exces-
  sively), whereas for "lv" LV will temporarily be set to '-c'.

You surely need -R (there was a security advisory regarding that,
less should be >= 608) in $LESS for colours, if you set it
yourself.  I have

  #?0|kent:tmp$ echo $LESS
  -IFe
  #?0|kent:tmp$ alias v
  alias v='LESS= less -RIFe'

but my $MAILRC unsets it.  (Actually it now does

\vput ! i /dev/null 2>&1
\if $? -eq 0
\env set LESS=RIFe
\el
\env unset LESS # builtin!
\end

even though expensive because i like -e better than -E, and
busybox less has no -E.  (One of the things i would like to do.))


 |I am happy I helped you with that. Thank you for all detailed kind \
 |help you offer me!!

Yes, thank you, what a bug.
And thanks for using this little thing.

 |Haris
 --End of <20230218103017.wj41n%haris...@otenet.gr>

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Colours colour only a few of my headers

2023-02-17 Thread Steffen Nurpmeso
Hello dear Mr. from beautiful Greece!

(well, the Country anyway.  The Light!  The nature!  The sea!  The
food!  Italy and Greece, i am so .. ach.)

Χάρης Καραχριστιανίδης wrote in
 <20230217201526.h5ogc%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230217191546.bzynv%haris...@otenet.gr>:
 |>|Only headers that begin after previous mail or header summary are colour\
 |>|ed. Headers that are on the top of the page or in the middle of an \
 |>|empty page are not coloured. Shouldn'e the behaviour be the same for \
 |>|all headers?
 ...
 |> No, content cannot be coloured yet.  And this will require v15
 ...
 |Sorry page is the wrong word, screen is the dorrect work in my previous \
 |email.
 |I am not talking about the body of emails but about each email header. \
 |The header of most of my emails is not coloured depending on conditions \
 |I described. I can send you photos.

You actually have found a _horrifying_bug_!
I did never see it because i work practically a hundred percent
with the development version, with memory checks and debug
compiler flags.

Please ensure that only non-empty "preconditions" are used (ie
dot, and the header names in your config), please simply leave off
empty ones.  Like so

  colour 256 sum-threadfg=39,ft=bold,ft=reverse dot
  colour 256 sum-threadfg=172
  colour 256 view-from_fg=142
  colour 256 view-header   ft=bold,fg=111 subject,from
  colour 256 view-header   fg=214 author,cc,sender,to
  colour 256 view-header   fg=217 reply-to,mail-followup-to,user-agent
  colour 256 view-header   fg=219
  colour 256 view-msginfo  fg=1
  colour 256 view-partinfo fg=2

(instead of eg "colour 256 view-header   fg=219 ''").

Does this problems for you?  (And i hope you have "set crt" and
use some "headerpick selections").

Fixes have been pushed to [master] and all the stable series.
That includes your credit.

Thank you very much!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Colours colour only a few of my headers

2023-02-17 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230217191546.bzynv%haris...@otenet.gr>:
 |Only headers that begin after previous mail or header summary are colour\
 |ed. Headers that are on the top of the page or in the middle of an \
 |empty page are not coloured. Shouldn'e the behaviour be the same for \
 |all headers?

What is "begin after previous mail", what is "top of the page" or
"middle of an empty page"?
Emails have a header.  Possibly they have multiple MIME parts,
each of those (may) have (some more) headers, too.
So if you "type" one message, the headers are coloured, the bodies
are not.  We do not support coloured body content (yet).

No, content cannot be coloured yet.  And this will require v15
framework, i did not consider to do that with that decade old
approach of fiddling MIME onto BSD Mail, because if you go there
then you surely want regular expression etc support to apply
different colours to different parts of the message (say quotes,
URLs, whatever), and that would be nothing of a terrible mess in
the current state of affairs.  (Later it will be a "a simple layer
that is plugged in", as if you put a letter in an envelope in an
envelope in an evelope etc.)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-17 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230217184829.j1piy%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230217133009.z4nty%haris...@otenet.gr>:
 |>|Steffen Nurpmeso  wrote:
 |>|> Χάρης Καραχριστιανίδης wrote in
 |>|>  <20230216081131.myqru%haris...@otenet.gr>:
 |>|>|Steffen Nurpmeso  wrote:
 |>|>|> Χάρης Καραχριστιανίδης wrote in
 |>  ...
 |>|For message "s-nail: type: needs an active mailbox" how should my \
 |>|mailbox \
 |>|be? Everything in my .mailrc points to the web imap folder.
 |> 
 |> Must be connected, then.
 |> If the connection breaks, and the code recognizes it, there is no
 |> "active mailbox" no more, and the above message appears.  You need
 |> to switch to another folder then.  (v15 will improve this a bit.
 |> BUT will have no IMAP for a while. :))
 ...
 |I pointed MBOX to imap but the message still appears..
 |
 |Thank you for help!
 |
 |account otenet {
 |   set MAIL=$HOME/.mail/account1/
 |   set smtp-use-starttls
 |   set mta=smtp://mail.xxx.xx
 |   set from=" "
 |   set folder=.mail/account1

Now you confuse me.  You want this to be on IMAP, right?
There are examples in the manual, btw.

 |   set MBOX=imaps://imap.xx.xx:xxx
 |   set record=imaps://imap.xx.xx:xxx/Sent
 |   set inbox=imaps://imap.xx.xx:xxx

It is *inbox* _or_ $MAIL.

 |   set imap-keepalive=240
 |   set imap-cache=~/.mail/.imap_cache
 |   shortcut imap imaps://imap.xx.xx:xxx
 |}


  set v15-compat=y
  account otenet {
 set smtp-use-starttls
 set mta=smtp://mail.xxx.xx
 set from=" "
 set folder=imaps://imap.xx.xx:xxx
 set inbox=$folder
 set MBOX=+

Though - primary and secondary being the same is something i had
to think about.  (Ie, implications, whether it works.  But in
modern mail usage MBOX is usually not used.  Why do you want it?)

 set record=+Sent
 set imap-keepalive=240
 set imap-cache=~/.mail/.imap_cache
 shortcut imap +

But instead simply say "file @" or "file +", easier in your
example i would think.

  set netrc-lookup

You said you have stored user and password in ~/.netrc.

  }

If you then run "s-nail -A otenet" you should go via internet to
$inbox aka $folder immediately.
If that fails because connection fails then there will be no
active mailbox and the above message occurs.
You could try "s-nail -A otenet -vv" and look whether connection
an authentication succeeds.
The above (more or less) should really work.

 --End of <20230217184829.j1piy%haris...@otenet.gr>

Ciao,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-17 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230217133009.z4nty%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 |>  <20230216081131.myqru%haris...@otenet.gr>:
 |>|Steffen Nurpmeso  wrote:
 |>|> Χάρης Καραχριστιανίδης wrote in
 ...
 |For message "s-nail: type: needs an active mailbox" how should my mailbox \
 |be? Everything in my .mailrc points to the web imap folder.

Must be connected, then.
If the connection breaks, and the code recognizes it, there is no
"active mailbox" no more, and the above message appears.  You need
to switch to another folder then.  (v15 will improve this a bit.
BUT will have no IMAP for a while. :))

Ciao -- greetings to Greece!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] view-msginfo doesn't affect most of my emails

2023-02-16 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230216201516.ye-bd%haris...@otenet.gr>:
 |Introductional message info lines of emails that begin from top of \
 |the screen or emails that begin from some point of the screen but the \
 |screen above is blank are not coloured, while they are coloured when \
 |an email continous from previous one. Should it be this way?

Oh, i cannot parse this.
What is the output of the command "colour"?
In general with commands "type" or "next" etc those headers are
shown which match the "headerpick type" selection, and they are
coloured if there is a (matching) "colour view-header" rule.
For example, i have (now and here)

  headerpick type retain author bcc blahblahblah cc content-type date from 
mail-followup-to message-id openpgp reply-to sender subject to user-agent
  #headerpick type ignore currently covers no fields
  #headerpick save retain currently covers no fields
  headerpick save ignore '^Delivered-To$' '^Envelope-To$' '^Original-.*$' 
'^X-.*$' '^ARC-.+$' '^Authentication-Results$' '^DKIM.+$' ^X- ^IronPort ^MGA 
^Spam '^(Accept|Content)-Language' \
^Thread-
  headerpick forward retain author cc date from list-id mail-followup-to 
message-id openpgp reply-to sender subject to
  #headerpick forward ignore currently covers no fields

  colour 256 sum-dotmark   fg=204,ft=bold dot
  colour 256 sum-headerfg=39 older
  colour 256 sum-headerfg=39,ft=reverse dot
  colour 256 sum-headerfg=45 ''
  colour 256 sum-threadfg=39,ft=bold,ft=reverse dot
  colour 256 sum-threadfg=172 ''
  colour 256 view-from_fg=142 ''
  colour 256 view-header   fg=214,ft=bold from,subject
  colour 256 view-header   fg=214 author,cc,sender,to
  colour 256 view-header   fg=217 reply-to,mail-followup-to,user-agent
  colour 256 view-header   fg=219 ''
  colour 256 view-msginfo  fg=76,ft=bold ''
  colour 256 view-partinfo fg=76 ''
  colour 256 mle-position  fg=203,ft=reverse ''
  colour 256 mle-promptfg=203 ''
  colour 256 mle-error bg=124 ''
  colour iso sum-dotmark   ft=reverse,fg=brown dot
  colour iso sum-headerfg=brown dot
  colour iso sum-threadfg=brown dot
  colour iso sum-threadfg=magenta ''
  colour iso view-from_fg=red ''
  colour iso view-header   fg=white author,from,sender,subject
  colour iso view-header   fg=brown ''
  colour iso view-msginfo  fg=green ''
  colour iso view-partinfo fg=brown ''
  colour iso mle-position  fg=brown,ft=bold ''
  colour iso mle-promptfg=brown ''
  colour iso mle-error bg=red ''
  colour mono sum-dotmark   ft=bold,ft=reverse dot
  colour mono sum-headerft=bold dot
  colour mono sum-threadft=bold dot
  colour mono view-header   ft=bold author,from,sender,subject
  colour mono view-msginfo  ft=reverse,ft=underline ''
  colour mono view-partinfo ft=bold,ft=underline ''
  colour mono mle-position  ft=reverse ''
  colour mono mle-promptft=bold ''
  colour mono mle-error ft=reverse ''

This also applies to header fields of individual MIME parts.
(Though some are shown in the "view-partinfo" unless explicitly
"headerpick retain"ed, eg

  [-- #1.1.2 128/3783 text/html, quoted-printable, iso-8859-1 --]

(which is green here), but when i do

  headerpick type retain content-type

then the next time i see

  [-- #1.1.2 128/3783 quoted-printable --]
  Content-Type: text/html; charset=iso-8859-1

and that Content-Type: is in the default "view-header" colour.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-16 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230216144638.6oewi%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Steffen Nurpmeso wrote in
 |>  <20230215233117.7fibs%stef...@sdaoden.eu>:
 |>|Χάρης Καραχριστιανίδης wrote in
 ...
 |>| [.]+filter-html-tagsoup[.]
 |>| ...
 |>  if "$features" =% ,+filter-html-tagsoup,
 |>unmimetype text/html
 |>mimetype ?h text/html html htm
 |>  else
 |>#set pipe-text/html=’?* elinks -force-html -dump 1’
 |>set pipe-text/html=’?* lynx -stdin -dump -force_html’
 |>  endif
 ...
 |Hello Steffen,
 |No problem with my name, you copied/pasted it correctly! :-))
 |
 |The new code still does not offer to open text/html with lynx (or any \
 |app) when
 |? mimeview

Well mimeview does not apply to the builtin filter.
But if you would say "mimetype text/html html htm" then you should
be asked even for this text part, i think Stephen Isard bugged
that.  (You are supposed to "type" / "print" / "next" etc the
normal text parts, "mimeview" is only for the non-displayable
others, say.)

 |but as I said the following code works:
 |set mime-alternative-favour-rich
 |set pipe-text/html='?! lynx -stdin -force_html'

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-16 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in
 <20230216125738.s3ua4%haris...@otenet.gr>:
 ...
 |It works with
 |set mime-alternative-favour-rich
 |set pipe-text/html='?! lynx -stdin -force_html'
 |
 |eg ? mimeview 5 

Well mimeview and that favour-rich thing do not belong together.
But regardless, ok.  You could also include the manual thing

   define showhtml {
 \localopts yes
 \set mime-alternative-favour-rich pipe-text/html=?h?
 \type "$@"
   }
   \commandalias html \\call showhtml

and then do "html MESSAGE-NUMBER-OF-DESIRE".

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-16 Thread Steffen Nurpmeso
Hello.

Your moderate flag was still on.

Χάρης Καραχριστιανίδης wrote in
 <20230216081131.myqru%haris...@otenet.gr>:
 |Steffen Nurpmeso  wrote:
 |> Χάρης Καραχριστιανίδης wrote in
 ...
 |> Oh it is _such_ a pity i cannot speek Greek!
 |Aber ich spreche Deutch! :-) Deutschland ist auch sehr schoen!

Na ja.  Not where i life, and not in winter.  Too grey, too dark,
too cold.  Autobahn ist schön, for some strange notion of schön,
but i do not use it.

 |> With "open" you mean the "type" or "print" command?
 |I just write the email number and press enter. I suppose it is open?

This eventually ends up as the `next' command on the given message
list, so i tend to agree.

 |With
 | ? set pipe-text/html='?* lynx -stdin -dump -force_html'
 | ? type HTML-MESSAGE
 |
 |I get this error: "s-nail: type: needs an active mailbox"

Well, you should have opened one first :-)

 |Hereis my .mailrc :
 |
 |   set v15-compat

Make it set v15-compat=y.
Like this you do not need "wysh", and the rest is upwards
compatible.

 |   set emptystart
 |   set sendcharsets=utf-8,iso-8859-1
 |   set reply-in-same-charset
 |   set sendwait

Is default.

 |   set mimetypes-load-control

Without value is like not set.  I'll change this for v14.10, when
the variable was introduced we could not yet forbit empty
variables.  Credits.

 |wysh set pipe-application/pdf='?&=?  trap "rm -f \"${MAILX_FILENAME_\
 |TEMPORARY}\"" EXIT; trap "trap \"\" INT QUIT TERM; exit 1" INT \
 |QUIT TERM; mupdf "${MAILX_FILENAME_TEMPORARY}"'

(No "wysh", then.  But like i said, you possibly want to create
a ~/.mailcap that can be shared with other programs.
For example

  #@ ~/.mailcap

  application/pdf;\
/Applications/Preview.app/Contents/MacOS/Preview %s;\
test = [ "$(uname -s|tr '[:upper:]' '[:lower:]')" = darwin ] 2>/dev/null;\
nametemplate=%s.pdf; x-mailx-test-once
  application/pdf;\
infile=%s\;\
  trap "rm -f ${infile}" EXIT\;\
  trap "exit 75" INT QUIT TERM\;\
  mupdf "${infile}";\
test = [ -n "${DISPLAY}" ] >/dev/null 2>&1;\
nametemplate = %s.pdf; x-mailx-async; x-mailx-test-once
  application/pdf;\
pdfinfo %s\; pdftotext -layout %s -;\
test = command -v pdfinfo >/dev/null 2>&1; \
copiousoutput; nametemplate=%s.pdf; x-mailx-test-once

  application/*;\
echo 'This is "%t", it looks like:'\; < %s head -c 512 | cat -vet\; echo;\
copiousoutput; x-mailx-noquote; x-mailx-last-resort

  image/*;\
display %s;\
test = { [ -n "${DISPLAY}" ] && command -v display\; } >/dev/null 2>&1;\
x-mailx-test-once


 |set pipe-text/html='?* lynx -stdin -dump -force_html'
 |type HTML-MESSAGE
 |
 |account account1 {
 |   localopts yes

Not needed in an account.

 |   set ssl_force_tls

This is nada -> set smtp-use-starttls
(Will be implied default in v14.10.)

 |   set mta=smtp://user:p...@server.com:993
 |   set from="Me em...@email.com"

This surely does not work.  It must be either "Me " or
plain em@ai.l.  It seems you also want set fullnames.

 |   set folder=.mail/account1
 |   set record=imaps://user:p...@server.com:993/Sent
 |   set inbox=imaps://user:p...@server.com:993

I would suggest simply setting user and password, and drop that
user:pass thing everywhere.  For example

  set user=user password=pass

 |   set imap-keepalive=240
 |   set imap-cache=~/.mail/.imap_cache
 |   shortcut imap imaps://user:p...@server.com:993
 |   # Type oi to login to the IMAP account
 |   commandalias oi 'fi imap'
 |}
 |
 |and account2 follows
 |I open account1 with a .bashrc entry:
 |alias o="export MAIL=$HOME/.mail/account1/ && mailx -A account1"

..ok.. you could simply do this in the account

  ? set verbose; varshow MAIL; unset verbose
  #sync-environ
set MAIL=/var/mail/steffen
  ? set MAIL=/dubi.du
  ? var MAIL
  set MAIL=/dubi.du
  ? ! echo $MAIL
  /dubi.du

As this is exported automatically .. to at least children of
s-nail, not to its parent shell.

 |Everything works normally I think and without the 2 added lines (
 |set pipe-text/html='?* lynx -stdin -dump -force_html'
 |type HTML-MESSAGE
 |)
 |I don't have this error about active mailbox.
 |Thanks a lot for reply!

Ciao.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-16 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20230215233117.7fibs%stef...@sdaoden.eu>:
 |Χάρης Καραχριστιανίδης wrote in
 ...
 |Oh it is _such_ a pity i cannot speek Greek![.]

Hello Χάρης.

  ...
 | [.]+filter-html-tagsoup[.]
 | ...
 ||and this code in my .mailrc
 ||
 || if "$features" !% ,+filter-html-tagsoup,
 ||  set pipe-text/html='?* lynx -stdin -dump -force_html'
 ||endif
 ...
 ||nothing happens when I open html email. Any help?

I have changed the documentation example, and it now reads

 if "$features" =% ,+filter-html-tagsoup,
   unmimetype text/html
   mimetype ?h text/html html htm
 else
   #set pipe-text/html=’?* elinks -force-html -dump 1’
   set pipe-text/html=’?* lynx -stdin -dump -force_html’
 endif

which should work (i hope).
I gave credits to you, but i am, i apologise, in deep trouble
regarding the greek spelling of your name.  It is (with many
regrets) only copy and paste; i sorted in like "Ka" in THANKS.

Ciao,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] html mails don't open in lynx

2023-02-15 Thread Steffen Nurpmeso
Χάρης Καραχριστιανίδης wrote in

Oh it is _such_ a pity i cannot speek Greek!  A hundred years ago
i think it was everywhere here in Germany, and i think also in
France.  Beautiful Greece!!

 <20230215220157.xvfcj%haris...@otenet.gr>:
  ...
 |s-nail v14.9.24, 2022-03-26 (built for Linux)
 |Features included (+) or not (-):
 ...
 [.]+filter-html-tagsoup[.]
 ...
 |and this code in my .mailrc
 |
 | if "$features" !% ,+filter-html-tagsoup,
 |  set pipe-text/html='?* lynx -stdin -dump -force_html'
 |endif
 |
 |mimetype ?t application/mathml+xml mathml
 |
 |define showhtml {
 |  \localopts yes
 |  \set mime-alternative-favour-rich pipe-text/html=?h?
 |  \type "$@"
 |}
 |\commandalias html \\call showhtml
 |
 |nothing happens when I open html email. Any help?

With "open" you mean the "type" or "print" command?

As you do have that filter-html-tagsoup lynx(1) will never execute
in the above -- it solely depends on the mimetype, then.
And it may be that you have a /etc/mime.types or ~/mime.types
which defines something for html in addition to internal
mimetypes.

But in short: simply force your desired handler:

  ? set pipe-text/html='?* lynx -stdin -dump -force_html'
  ? type HTML-MESSAGE

This should execute the lynx one now, reintegrating output into
normal flow (with "set crt" this will likely startup the $PAGER
then).  This is for plain HTML message, a multipart one likely
wants to have a "set mime-alternative-favour-rich" first.

  ? set pipe-text/html='?! lynx -stdin -force_html'
  ? type HTML-MESSAGE

(Do not forget the "!" so we give up the terminal!)
This will then say you should use the `mimeview' command.

  ? mimeview HTML-MESSAGE

This will ask you, and if you say "y" then lynx starts up.

Using a mailcap entry may be the easier and sharable approach.
Does this help?  Sufficiently?

Using a mailcap handler is usually better and sharable, and
mimetype tricks can also be played, like

  ? unmimetype text/html
  ? mimetype ?h text/html html htm
  ? type HTML-MESSAGE

And unless i am mistaken now the built-in filter-html-tagsoup
should be used.

Ciao (may be off until tomorrow now, sorry!!!),

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Read message N on stdout?

2023-01-20 Thread Steffen Nurpmeso
Hello Morten.

Tricky header fields (from, reply-to etc), i reply-to.
(The one above may freely send now..)

Morten Bo Johansen wrote in
 :
 |I have aliased the following command to show the headers of all
 |unread messages in my inbox
 |
 |  mail -L :u -f imaps://mail.simply.com
 |
 |The output may look like
 |
 |  U 23 MitID  2023-01-20 11:27 /10349 Ordrebekræftelse \
 |  588215 -
 |
 |So I would like a command that would send the contents of this
 |message to stdout, so I do not have to enter interactive mode
 |to read it. Can I do that?

I do assume your mail is v14.9.24 (mail -V).

  #?0|$ mail -Sv15-compat=y -Sheadline=%m -L :u -f FILE
   18
  #?0|$ mail -Sv15-compat=y -# -Y 'type 18;quit' -f FILE | head -n1
  [-- Message 18 -- 97 lines, 4179 bytes --]:

(or

  $ echo type 18 | mail -Sv15-compat=y -#f FILE


(It is yet not possible to fine tune this output.  All or nothing,
with info lines as shown.)

 |If that is not possible, can I have a command which in one fell
 |swoop enters interactive mode, selects the message I want to
 |read (here, no. 23) and show its contents?

As above.
If you program you could avoid all the network up and down hassle
and one or two invocations for it all.  Some things already work
quite good, one could eloberate something.  Just ask on interest.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Compilation failed on cygwin gcc

2023-01-13 Thread Steffen Nurpmeso
Hello klu.

klu wrote in
 <055f1224-2277-b9a6-762d-c14e7d5ba...@gmail.com>:
 |Hi Steffen, yes your patch works great on Cygwin.

All right, fine.  Stupid me.

Ciao!!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Compilation failed on cygwin gcc

2023-01-11 Thread Steffen Nurpmeso
klu wrote in
 :
 |Hi thanks for the patch! I'll try and report back the result.

Great!  Thank you.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Compilation failed on cygwin gcc

2023-01-11 Thread Steffen Nurpmeso
Hello.

klu wrote in
 :
 |I'm using the source code downloaded from:
 |https://ftp.sdaoden.eu/s-nail-14.9.24.tar.xz
 |
 |gcc 11.3
 |
 |Below is the build log and repro. Not sure what other logs I can help \
 |provide.
 ...
 |/cygdrive/c/Users/user/Downloads/s-nail-14.9.24/src/mx/cmd-head.c:142:7:
 |error: expected identifier before numeric constant
 |  142 |   _IFMT   = 1<<2,

Thanks for the report.
Well old style code (of mine) that messes with the prefix (_..)
reserved for C libraries etc.  I presume this is the problem here.
Could you try out the attached patch??

Never tried cygwin apart of digging through the source code like
grazy over twenty years ago to get an easy notion of what goes on
Windows or not, just in case porting to Windows would become an
option.  Would you be willing to "make test" and report that back,
this would be great?

On the issue, .., i hope there are no more clashes that prevent
compilation, the plan was to slowly move away from the old syntax.

  ...

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
diff --git a/src/mx/cmd-head.c b/src/mx/cmd-head.c
index 62eefa192a..b5746c0efd 100644
--- a/src/mx/cmd-head.c
+++ b/src/mx/cmd-head.c
@@ -139,9 +139,9 @@ a_chead__hprf(uz yetprinted, char const *fmt, uz msgno, FILE *f,
   _NONE   = 0,
   _ISDOT  = 1<<0,
   _ISTO   = 1<<1,
-  _IFMT   = 1<<2,
+  a_IFMT   = 1<<2,
   _LOOP_MASK  = (1<<4) - 1,
-  _SFMT   = 1<<4,/* It is 'S' */
+  a_SFMT   = 1<<4,/* It is 'S' */
   /* For the simple byte-based counts in wleft and n we sometimes need
* adjustments to compensate for additional bytes of UTF-8 sequences */
   _PUTCB_UTF8_SHIFT = 5,
@@ -185,7 +185,7 @@ a_chead__hprf(uz yetprinted, char const *fmt, uz msgno, FILE *f,
 subjlen -= n;
  }
  if (*fp == 'i')
-flags |= _IFMT;
+flags |= a_IFMT;
 
  if (*fp == '\0')
 break;
@@ -431,7 +431,7 @@ jmlist: /* v15compat */
  }
  break;
   case 'S':
- flags |= _SFMT;
+ flags |= a_SFMT;
  /*FALLTHRU*/
   case 's':
  if (n == 0)
@@ -442,18 +442,18 @@ jmlist: /* v15compat */
 subjlen = wleft;
  if (UCMP(32, ABS(n), >, subjlen))
 n = (n < 0) ? -subjlen : subjlen;
- if (flags & _SFMT)
+ if (flags & a_SFMT)
 n -= (n < 0) ? -2 : 2;
  if (n == 0)
 break;
  if (subjline == NULL)
-subjline = a_chead__subject(mp, (threaded && (flags & _IFMT)),
+subjline = a_chead__subject(mp, (threaded && (flags & a_IFMT)),
   subject_thread_compress, yetprinted);
  if (subjline == (char*)-1) {
 n = fprintf(f, "%*s", n, n_empty);
 wleft = (n >= 0) ? wleft - n : 0;
  } else {
-n = fprintf(f, ((flags & _SFMT) ? "\"%s\"" : "%s"),
+n = fprintf(f, ((flags & a_SFMT) ? "\"%s\"" : "%s"),
   colalign(subjline, ABS(n), n, ));
 if (n < 0)
wleft = 0;


Re: [S-mailx] picking up one's GoogleMail

2023-01-04 Thread Steffen Nurpmeso
P.S.: please be patient, until next week i can only access the
internet shortly about twice a day.

Ciao,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] picking up one's GoogleMail

2023-01-04 Thread Steffen Nurpmeso
Hello Mr. Bell.

rb...@alumni.caltech.edu wrote in
 <202301040522.3045mmct002...@randytool.net>:
 | I fetch my mail with fetchmail, read it with s-mailx.  I got
 |an app password from Google, which required verification by use of a
 |phone number to which it sent a text.  I use fetchmail with the new
 |password the same as I did before.  I have a 'hotspot' modem that has
 |a phone number because it has to, but no phone service.  That served
 |the purpose.  When I log in from an apparently-different IP Google

Really?  I had to verify via SMS for sure!

 |requires the second step of verification, but gives me the choice of
 |that number or an e-mail sent to my gmail account.  This never happens
 |when I just pick up mail with fetchmail.  I log in about once/month.

There is OAuth-enabled fetchmail on the internet.
What is missing for you to be able to fetch via the MUA?

 | 'less secure apps' stopped being a choice for me.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] "App password" or "OAuth 2.0"

2023-01-04 Thread Steffen Nurpmeso
Hello Josef.

As this is the first post, a good and healthy 2023 to you and all
the list members!

Josef Jurek wrote in
 :
 |Since GoogleMail introduced their new authentication
 |on May 30 2022, I have been unable to access GoogleMail
 |with s-nail-14.9.24.

I was unable to access gmail for years without turning on "lesser
secure apps", that you could is a surprise to me!

 |I have read the "OAuth 2.0" thread of Oct 2022 between
 |Steffen Nurpmeso and Stephen Isard.
 |
 |If I understand correctly, my two options to access
 |GoogleMail with s-nail are:
 |
 | (1)
 | Use GoogleMail's "App Password" option with 2-Step Verification.
 | This means that Google will have my cell-phone number.
 |
 | With this method, will I be able to use s-nail-14.9.24
 | to connect to my GoogleMail account.?

I was last i tried.  (In the meantime i have switched all accounts
to OAuth so i cannot re-verify.)

 | Is it true that this method is "relatively easy"?

Unless Google starts beating you that you are using bad bad
software that should not be used because it uses lesser secure
authentication mechanisms, i would say yes.
I was never contacted by cell phone (except the first confirmation
SMS, if i recall correctly).

 | (2)
 | Use the s-nail-oauth-helper.py  script as supplied by
 | Steffen N. in the "OAuth 2.0" thread of Oct 2022.

That works.  (In conjunction with the posted macros it "embeds
nicely".)  It requires a modern Python3 unfortunately.

(I am still thinking whether, and if, how to embed it better
without macros, as some packagers do not include the default
nail.rc which will ship it.)

 |Is my understanding of these two options correct?

Like Predrag said, "lesser secure apps" may still work as such.
They started to turn it off quite frequently once i was still
using it, so i had to go there via browser, and there were many
"security notifications" or how that was named.

There are other similar scripts, mutt has one.  But i think our
one gives the most user hints (with --action=manual and
--action=template (for --provider=Google); BUG: you need
a --resource= argument even for =manual).

It includes the necessary OAuth credentials to use s-nail with
Google, too, so you normally just fill in the login_hint= from the
--action=template output with your Google address.
...Verified it works with my sdaoden[@]gmail.com just fine.

The script (with some tweaks fixed) is now public at [1].
Please call back if it does not work just seamlessly for you!

Ciao!

  [1] https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

  Note: user "moon", password "mars", as in:

  $ curl -u moon:mars --basic -O 
https://git.sdaoden.eu/browse/s-toolbox.git/plain/oauth-helper.py

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] v14.10: delayed further (to hopefully spring 2023)

2022-11-19 Thread Steffen Nurpmeso
Hello list.

I was planning to write this for some days, because v14.10 will
definetely not happen no more in 2022.
Too much is still left to do.

We got $(( 1 + 1 ))-style arithmetic, and our `if'.. conditional
expression are now en par with the [[ .. ]] construct of some
shells, including nice regular expression match group access, and
even the usual file test(1) operators!  Ie v14.10 is capable of

  ? \if bananarama =~?case (.*)NANA(.*); echo $^0: $^1 and $^2; \end
  bananarama: ba and rama
  ? if -e /etc/passwd && -f? _; echo yep; end
  yep
  ? if ! -w /etc/passwd; echo ..ok; end
  ..ok

(where "case" is still optional, as is the "saturated" missing
from the second.)  And i have a new desc calculator that replaced
an according perl(1) sh(1)ell alias:

  define xarith {
 #\if true
\local eval ignerr : \$((r=("${@}")))
\local set e=${?}
\if ${e} -eq 0; \vexpr = ${r}; \end
 #\else
#\local eval ignerr set r=\"\$(("${@}"))\"
#\local set e=${?}
#\if ${e} -ne -1; \vexpr = ${r}; \end
 #\end
 \return ${e}
  }
  \commandalias xa '\call xarith'

  ?  xa (21 | 42) + 1
  0b        0100
  0100 | 0x40 | 64

Well and if you ask ME why a command line mailer needs that.
Eh, then i had to think.
:-)

It will have email-related improvements, too. ;

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] setting send mail `read' by default

2022-11-19 Thread Steffen Nurpmeso
Hello Hans.

hbeze...@kliksafe.nl wrote in
 <20221119185811.cpj_j%hbeze...@kliksafe.nl>:
 |This may be a trival question, but when I send a mail, a copy gets placed 
 |in the 'Sent' folder marked `unread'.
 |Can this be set to `read' by default?

No.  And it is also not so easy to accomplish in general.
(For MBOX we could adjust it by writing the according status:
header right out, but for maildir for example new messages get
linked into /new/, which had to be changed with special
treatment.)

P.S.: i thought whether you could use some hook to automatically
mark all "search:nu" messages, but there is currently no command
which you could use to toggle _that_ state.  You _could_ instead
do "search:nu; | ` :", but this echoes something.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Forcing attachments to base64 encoding

2022-10-06 Thread Steffen Nurpmeso
Hello Mr. Bell.

rb...@alumni.caltech.edu wrote in
 <202210052228.295msads025...@randytool.net>:
 | Doesn't fromdos work?  It's in Slackware's bin package,
 |currently bin-11.1-x86_64-5

The dos2unix and unix2dos can be replaced (on UNIX) by

  awk '{print $0 "\r"}' < tcnv.unix > tcnv.dos

  awk 'BEGIN{RS="\r\n"}{print $0}' < tcnv.dos > tcnv.unix

where it is possibly better to use \015 for \r and \012 for \n.
Note multi-byte $RS is "unspecified", but the above works with
gawk, mawk, nawk and busybox awk (v1.36.0.git).

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Forcing attachments to base64 encoding

2022-10-05 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20221005145112.06bzw%stef...@sdaoden.eu>:
 |JHolder wrote in
 | <8f7d8f37-5a84-cba7-e5f8-13e0e56b6...@simulakrum.com>:
 ||That is great news, I look forward to the release.  In the meantime, I 
 ||have been using unix style line endings for those that can take it.

You can (but you have to, too) do

  awk '{print $0 "\r"}' < tcnv.unix > tcnv.dos

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Forcing attachments to base64 encoding

2022-10-05 Thread Steffen Nurpmeso
JHolder wrote in
 <8f7d8f37-5a84-cba7-e5f8-13e0e56b6...@simulakrum.com>:
 |That is great news, I look forward to the release.  In the meantime, I 
 |have been using unix style line endings for those that can take it.

Sorry for the inconvenience.  I have pushed an automatic fix that
will appear as if it would do the right thing.

Thanks again for reporting the issue!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Forcing attachments to base64 encoding

2022-10-05 Thread Steffen Nurpmeso
Hello John.

Steffen Nurpmeso wrote in
 <20221003205932.wlnsf%stef...@sdaoden.eu>:
 |Steffen Nurpmeso wrote in
 | <20220929164300.bw8t5%stef...@sdaoden.eu>:
 ||JHolder wrote in
 || :
 | ...
 |||Recently, I have run into a problem where CSV files with CRLF line 
 |||endings are getting mangled and arrive at the the recipient with the 
 |||0x0D, 0x0A changed to three 0x0A characters.  I thought the easiest way 
 |||to solve this would be to force the attachments to base64, but I have 
 |||not been able to find the correct settings to make this happen.
 |
 |I today have implemented such a thing, but it will require v14.10
 |(_hopefully_ around christmas).
 |
 |base64 can be enforced by prefixing ! to a character set
 |specification:
 |
 |   -a file[=[!]input-charset[#[!]output-charset]], --attach=..
 ...
 |||Could anyone point me in the direction I need to look to figure this out?
 ||
 ||This is an interesting point, John.
 ||It is actually feature, and we take quite some steps to get there!
 |
 |This applies only to the saving side it seems.
 ...
 ||Until then there is not much you can do, unfortunately, except
 ||maybe packing these files with ZIP or anything else that is
 ||understood on the Windows receiver side?[.]
 |
 |I have to think about what more can or should be done.
 |But the above will do it, regardless the outcome.

Ok, so what i did is pushing a fix to [master] and all the
[stable] series, we unfortunately have to enforce a MIME encoding
for all text files which have CRLF line endings until "the magic",
long envisioned, MIME layer rewrite will finally happen.

This may also be quoted-printable, so the above user enforced
base64 request i keep nonetheless.

  The problem as it happens was introduced by myself, once
  i tweaked our MBOX code to comply to the standard RFC 4155,
  which explicitly requires LF line endings.

  Of course a fully complying code would reencode all parts of
  a mail message accordingly, dependent upon what the actual
  target is, user display, MBOX, Maildir, SMTP, etc.  Yet this is
  exactly what the BSD Mail codebase never could.  So we have the
  RFC 5322 Internet Message Format standard which requires CRLF,
  and RFC 4155 MBOX which requires LF.  Since this is a Unix
  program and we effectively _never_ could truly deal with CRLF,
  only pass it through when existing (but not only in a message
  part content, mind you), i went with RFC 4155 since that does
  usually exactly what UNIX users want, and this software cannot
  Windows nor old MacOS anyway.  With that single exception you
  ran into.

Ciao John -- and thank you for the report!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Forcing attachments to base64 encoding

2022-10-03 Thread Steffen Nurpmeso
Hello John.

Steffen Nurpmeso wrote in
 <20220929164300.bw8t5%stef...@sdaoden.eu>:
 |JHolder wrote in
 | :
 ...
 ||Recently, I have run into a problem where CSV files with CRLF line 
 ||endings are getting mangled and arrive at the the recipient with the 
 ||0x0D, 0x0A changed to three 0x0A characters.  I thought the easiest way 
 ||to solve this would be to force the attachments to base64, but I have 
 ||not been able to find the correct settings to make this happen.

I today have implemented such a thing, but it will require v14.10
(_hopefully_ around christmas).

base64 can be enforced by prefixing ! to a character set
specification:

   -a file[=[!]input-charset[#[!]output-charset]], --attach=..
  (Send mode) Attach file, subject to tilde expansion (see
  Filename transformations and folder).  In Compose mode the
  COMMAND ESCAPES ~@ and especially the scriptable ~^ provide
  alternatives for attaching files.

  If file is not accessible but contains an equal-sign `=' a
  character set specification is split off.  If only an input
  one is given it is fixated and no conversion is applied; an
  empty, or the special string hyphen-minus `-' means
  ttycharset.  If an output one is given the conversion is
  performed on-the-fly, not considering file type nor content;
  however, empty string or hyphen-minus `-' enforce the
  default Character sets conversion (`-a file', `-a file=#',
  and `-a file=-#-' are identical), later applied after MIME-
  classifying file (HTML mail and MIME attachments, The
  mime.types files).  Without `,+iconv,' in features only this
  mode is available.  The character set names may be prefixed
  with exclamation mark `!' to enforce base64 mime-encoding of
  the attachment.

  ...
 ||
 ||Could anyone point me in the direction I need to look to figure this out?
 |
 |This is an interesting point, John.
 |It is actually feature, and we take quite some steps to get there!

This applies only to the saving side it seems.
When writing a test for the new feature i recognized that storing
the attachment in the message does, actually, not convert the
terminal newline sequence to the UNIX/POSIX one, i falsely
remembered this.  (But, it is rather by accident.)
When we then write the part out, however, we normalize.

 |Thanks for the suggestion, i will try to find a solution for it!

Even more cryptic magic.

 |Until then there is not much you can do, unfortunately, except
 |maybe packing these files with ZIP or anything else that is
 |understood on the Windows receiver side?[.]

I have to think about what more can or should be done.
But the above will do it, regardless the outcome.

You have been credited with the above mail, please complain if
this is not a good thing to do.

Thanks for the suggestion, John!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth 2.0 password helper for Google, Microsoft, Yandex

2022-10-03 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <16061-1664826242-422...@sneakemail.com>:
 |
 |
 |On Mon, 3 Oct 2022, Stephen Isard wrote:
 |...
 |>   'invalid_client', 'error_description': "AADSTS70002: The provided \
 |>   client
 |>   is not supported for this feature. The client application must be
 |>   marked as 'mobile.
 |>
 |> I can't see how to mark the client registration as mobile.  Did "mobile" \
 |> come 
 |> up when you registered your client?
 |
 |Never mind. I've found it.  At the bottom of the "Authentication" menu 
 |page, there is
 |
 |   Allow public client flows
 |   Enable the following mobile and desktop flows:
 | No keyboard (Device Code Flow)
 |
 |and you have to change the default "no" to "yes"

Yes!  But "Enable the following mobile and desktop flows:" i think
i have not read yet.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth 2.0 password helper for Google, Microsoft, Yandex

2022-10-03 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <15529-1664822950-583...@sneakemail.com>:
 |On Mon, 3 Oct 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |>|For all I know, that might be a problem specific to office365 accounts
 |>|tied to organizations and someone with a personal Microsoft account
 |>|could be ok.  If any s-nail user has chosen on their own to use
 |>|Microsoft as their email provider, as opposed to being outsourced to
 |>|them by an organization, it would be interesting if they could check.
 |>
 |> I have two free accounts on outlook.com, and i can access without
 |> any problem with either.
 |
 |Good.

So far yes.

 |> So likely it is that your organization tries to avoid getting
 |> third party code behind some walls.  That however makes me wonder
 |> why your own id works without such trouble, then?
 |
 |Well, I set up the id when logged in to my organization account, so 
 |maybe that makes it ok?

I do not know, Stephen.  First real contact with Microsoft since
Windows 95B.  (Except that this laptop does have a Windows
partition, but merely five minutes therein.)
I would find it surprising that you then cannot set free the
application yourself, too.  As a normal user.

 |Unsurprisingly, I get the same unverified app message if I try to 
 |authorize with your account using flow=devicecode from an ssh login, 
 |where running a browser on the same machine is not practical.  However, 
 |when I try with my own client id and device id, I get a different error 
 |message:
 |
 |   'invalid_client', 'error_description': "AADSTS70002: The provided client
 |   is not supported for this feature. The client application must be
 |   marked as 'mobile.
 |
 |I can't see how to mark the client registration as mobile.  Did "mobile" 
 |come up when you registered your client?

This is a "Mobile and desktop applications", with "Allow public
client flows" enabled.  I have no publisher domain, that makes it
not verifiable, but i think i do not want to go further down this
road, it was which made Google say something between 15K$ and 75K$
will be needed...

One thing i noticed is that the application i created with the
fozzi-baer (the false) account had the very same tenant as the
one you gave me in private, whereas this now (the
sugar.in.the.morning one) has a different one.  But i have _no_
idea of tenants, and stumbling over the German variant of the
Microsoft manual i stopped reading because of dozens of
occurrences of the word "Mandanten", a total buzz.  (To me this
would have been "client", but even dict.cc hammers this one
through, specifically for software user groups.  Whatever.)

I am a bit out of ideas Stephen.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] OAuth 2.0 password helper for Google, Microsoft, Yandex

2022-10-03 Thread Steffen Nurpmeso
Hello.

[Josef, i Cc: you again, since Stephen found a test leftover that
makes the script essentially useless.]

Stephen Isard wrote in
 <3876-1664733894-101...@sneakemail.com>:
 |A couple of snags:
 |
 |On Sun, 2 Oct 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |
 |>  _If_ you only have one account at a service provider, say,
 |>  Google, then all you need to do to get yourself going is:
 |>
 |># s-nail-oauth-helper.y --resource CONFIG-PATH --provider Yandex
 |
 |Typo: s-nail-oauth-helper.py --resource CONFIG-PATH --provider Google 
 |:-)

Now too late.

 |More seriously, in the definition of act_authorize in the python script
 |
 |def act_authorize(args, cfg, dt): #{{{
 |global auth_code
 |print('* OAuth 2.0 RFC 6749, 4.1.1. Authorization Request', file=sys.st\
 |derr)
 |e = False
 |for k in client.keys():
 |   if k != 'refresh_token' and k != 'access_token' \
 | and not cfg.get(k) and client.get(k, '.') == '':
 |  print('! Missing client key: %s' % k, file=sys.stderr)
 |  e = True
 |if e:
 |   print('PANIC: configuration incomplete or invalid', file=sys.stderr)
 |   return EX_DATAERR
 |
 |return EX_OK

ouch!!

 |The return line occurs too early.  It causes the script to finish 
 |without doing anything.  Commenting it out lets authorization go ahead.

Yes.  One last testing round with the new --hook thing was not
completely undone!  The updated version is attached.

Thanks for noticing!

 |Also, when I try to authorize using the Microsoft client id that the 
 |script puts into the config file during --action=template, I get an 
 |error page from Microsoft with the text:
 |
 |myname@myorganization
 |Need admin approval
 |unverified
 |This app may be risky. If you trust this app, please ask your admin to 
 |grant you access. Learn more
 |Have an admin account? Sign in with that account
 |Return to the application without granting consent
 |
 |If I edit in my own client_id, obtained by following the Mutt advice 
 |that you quote, then all is well and I get authorized successfully.

Hm.

 |For all I know, that might be a problem specific to office365 accounts 
 |tied to organizations and someone with a personal Microsoft account 
 |could be ok.  If any s-nail user has chosen on their own to use 
 |Microsoft as their email provider, as opposed to being outsourced to 
 |them by an organization, it would be interesting if they could check.

I have two free accounts on outlook.com, and i can access without
any problem with either.
So likely it is that your organization tries to avoid getting
third party code behind some walls.  That however makes me wonder
why your own id works without such trouble, then?  Does not make
much sense since most attacks come from the inside do they?
I have _no_ idea on what to do.

Thanks for the above.  Please find the corrected script attached.

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
#!/usr/bin/env python3
#@ Create and update OAuth2 access tokens (for S-nail).
#
# 2022 Steffen Nurpmeso 
# Public Domain

# Empty and no builtin configs
VAL_NAME = 'S-nail'

import argparse
import base64
from datetime import datetime as dati
import http.server
import json
import os
import pickle
import socket
import subprocess
import sys
import time
from urllib.error import HTTPError
from urllib.parse import urlencode, urlparse, parse_qs
from urllib.request import urlopen

EX_OK = 0
EX_USAGE = 64
EX_DATAERR= 65
EX_NOINPUT = 66
EX_SOFTWARE = 70
EX_CANTCREAT = 73
EX_TEMPFAIL = 75

# Note: we use .keys() for configuration checks: all providers need _all_ keys.
providers = { #{{{
   'Google': {
  'authorize_endpoint': 'https://accounts.google.com/o/oauth2/auth',
  'devicecode_endpoint': 'https://oauth2.googleapis.com/device/code',
  'devicecode_grant_type': None,
  'token_endpoint': 'https://accounts.google.com/o/oauth2/token',
  'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob',
  'tenant': None,
  'scope': 'https://mail.google.com/',
  'flow': 'redirect',
  'flow_redirect_uri_port_fixed': None
   },
   'Microsoft': {
  'authorize_endpoint':
'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
  'devicecode_endpoint':
'https://login.microsoftonline.com/common/oauth2/v2.0/devicecode',
  'devicecode_grant_type': None,
  'token_endpoint':
'https://login.microsoftonline.com/common/oauth2/v2.0/token',
  'redirect_uri':
'https://login.microsoftonline.com/common/oauth2/nativeclient',
  'tenant': 'common',
  'scope': (
'offline_access https://outlook.office.com/IMAP.AccessAsUser.All '
'https://outlook.office.com/POP.AccessAsUser.All '
'https://outlook.office.com/SMTP.Send'
),
 

Re: [S-mailx] OAuth 2.0 password helper for Google, Microsoft, Yandex

2022-10-03 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20221002001524.umx8j%stef...@sdaoden.eu>:
 ...
 |Due to week long prodding of Stephen Isard in private i moved my
 |stupid ass to get the stuff done, at least a bit.

P.S.: he also tested and gave feedback.  And he convinced me that
it is really possible to create a Microsoft client_id that is
usable by everyone, i was just doing it wrong.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] OAuth 2.0 password helper for Google, Microsoft, Yandex

2022-10-01 Thread Steffen Nurpmeso
You could initiate an oauth-check-token{} call from within
on-compose-splice additionally to overcome this, which is not very
expensive if it has access to $oauth-helper-times.

I wish you all a nice Sunday!

Ciao and good night from Germany!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
#!/usr/bin/env python3
#@ Create and update OAuth2 access tokens (for S-nail).
#
# 2022 Steffen Nurpmeso 
# Public Domain

# Empty and no builtin configs
VAL_NAME = 'S-nail'

import argparse
import base64
from datetime import datetime as dati
import http.server
import json
import os
import pickle
import socket
import subprocess
import sys
import time
from urllib.error import HTTPError
from urllib.parse import urlencode, urlparse, parse_qs
from urllib.request import urlopen

EX_OK = 0
EX_USAGE = 64
EX_DATAERR= 65
EX_NOINPUT = 66
EX_SOFTWARE = 70
EX_CANTCREAT = 73
EX_TEMPFAIL = 75

# Note: we use .keys() for configuration checks: all providers need _all_ keys.
providers = { #{{{
   'Google': {
  'authorize_endpoint': 'https://accounts.google.com/o/oauth2/auth',
  'devicecode_endpoint': 'https://oauth2.googleapis.com/device/code',
  'devicecode_grant_type': None,
  'token_endpoint': 'https://accounts.google.com/o/oauth2/token',
  'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob',
  'tenant': None,
  'scope': 'https://mail.google.com/',
  'flow': 'redirect',
  'flow_redirect_uri_port_fixed': None
   },
   'Microsoft': {
  'authorize_endpoint':
'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
  'devicecode_endpoint':
'https://login.microsoftonline.com/common/oauth2/v2.0/devicecode',
  'devicecode_grant_type': None,
  'token_endpoint':
'https://login.microsoftonline.com/common/oauth2/v2.0/token',
  'redirect_uri':
'https://login.microsoftonline.com/common/oauth2/nativeclient',
  'tenant': 'common',
  'scope': (
'offline_access https://outlook.office.com/IMAP.AccessAsUser.All '
'https://outlook.office.com/POP.AccessAsUser.All '
'https://outlook.office.com/SMTP.Send'
),
  'flow': 'redirect',
  'flow_redirect_uri_port_fixed': None
   },
   'Yandex': {
  'authorize_endpoint': 'https://oauth.yandex.com/authorize',
  'devicecode_endpoint': 'https://oauth.yandex.com/device/code',
  'devicecode_grant_type': 'device_code',
  'token_endpoint': 'https://oauth.yandex.com/token',
  'redirect_uri': 'https://oauth.yandex.com/verification_code',
  'tenant': None,
  'scope': 'mail:imap_full mail:imap_ro mail:smtp',
  'flow': 'redirect',
  'flow_redirect_uri_port_fixed': 'port_number_to_use'
   }
}
#}}}

# Note: we use .keys() and '' for configuration checks!
client = {
   'access_token': '',
   'client_id': '',
   'client_secret': None, # optional
   'refresh_token': '', # effectively optional
   'login_hint': None # optional
}

def arg_parser(): #{{{
   p = argparse.ArgumentParser(
 description='Manage OAuth 2.0 access tokens (for ' + VAL_NAME + ')',
 epilog='''

This is an RFC 6749 OAuth 2.0 Authorization Framework helper.
Create a new --resource for --provider via --action=template,
fill in client_id=, maybe login_hint=, and all other provider needs
(see the according --provider specific --action=manual).
Other providers can be used by editing such a template.
Only the template contains documenting comments.
Then run --action=access; because upon first contact that requires
interaction, an explicit --action=authorize can be used instead.
(For S-nail/S-mailx, one may get away with only
  --action=access --provider=XY --resource=YZ,
dependent upon --provider.)
Force an access token --action=update even for non-expired timeouts.
   ''')

   p.add_argument('-a', '--action', dest='action',
  choices=('access', 'authorize', 'manual', 'template', 'update'),
  default='access',
  help='the action to perform'),
   p.add_argument('-H', '--hook', dest='hook', default=None,
  help='''
configuration load/save hook: instead of using a configuration file,
a hook script can be specified.  It will be invoked via "load|save"
and the --resource  argument, the data format is the same.
(Note: values are not quoted!)
 '''),
   p.add_argument('-p', '--provider', dest='provider',
  choices=providers, default=None,
  help='Technology Giant of choice; ignored if --resource yet exists!')
   p.add_argument('-R', '--resource', required=True, dest='resource',
  help='resource (file) to read configuration from and write to')
   p.add_argument('-d', '--debug', action='store_true', help='be noisy')

   return p
#}}}

def config_load(args, dt): #{{{
   if args.debug:
  print('# Try load resource %s' % args.resource, file=sys.stderr)

   #
   if 

Re: [S-mailx] Forcing attachments to base64 encoding

2022-09-29 Thread Steffen Nurpmeso
Hello John.

JHolder wrote in
 :
 |First of all, thank you for s-mailx, it has been a tool that I have 
 |relied on for some time whenever I need SMTP on a server without an MTA.

A lot remains to do, but thank you.

 |Recently, I have run into a problem where CSV files with CRLF line 
 |endings are getting mangled and arrive at the the recipient with the 
 |0x0D, 0x0A changed to three 0x0A characters.  I thought the easiest way 
 |to solve this would be to force the attachments to base64, but I have 
 |not been able to find the correct settings to make this happen.
 |
 |I have experimented with -X mimetype, and I can change the mimetype of 
 |the attachment, but I cannot get the attachment to base64.  I thought 
 |perhaps -S sendcharsets would help, but no luck in any of my testing.
 |
 |Could anyone point me in the direction I need to look to figure this out?

This is an interesting point, John.
It is actually feature, and we take quite some steps to get there!
It seems your files are plain US-ASCII with relatively short lines
and nothing else in sight which would enforce us to encode the
files.

  For text files on UNIX/POSIX the line endings are \n (U+000A,
  LF), on elder MacOS \r (U+000D, CR), and on MS-DOS and
  follow-ups, some (most) text-based network protocols and whatnot
  \r\n.

  On MS- i think the file interface for ISO C and other
  programming languages allows specifying whether the file is
  O_BINARY or O_TEXT, and the C library and others would
  automatically convert \n to \r\n as necessary in O_TEXT mode
  (depending on mount point even says the [1] that i searched for
  this answer).

[1] https://cygwin.com/pipermail/cygwin/2019-February/240094.html

  We are a UNIX/POSIX program, and on UNIX the line ending is \n,
  and no conversion takes place.  (There is no separation in
  between text and binary files, it is just that text files happen
  to have lines separated by \n, this is why POSIX has the notion
  of a "Printable File", too.)

So we classify the file, it seems to be a text-file which, to its
own disappointment, has \r\n line endings, which we explicitly
deal with in order to make these files available on UNIX without
the need for an additional program (there were dos2unix and
unix2dos in the past, i think tr(1) would do for this, too).

[if(c == '\n'){}
...]
/* A bit hairy is handling of \r=\x0D=CR.
 * RFC 2045, 6.7:
 * Control characters other than TAB, or CR and LF as parts of CRLF
 * pairs, must not appear.  \r alone does not force _CTRLCHAR below since
 * we cannot peek the next character.  Thus right here, inspect the last
 * seen character for if its \r and set _CTRLCHAR in a delayed fashion */
 /*else*/ if(lastc == '\r')
   mtc |= a_MT_C_CTRLCHAR;

So we _would_ assume the file is binary if there would be a sole
\r somewhere, or whatever else, but not as part of \r\n.

So short answer: we cannot yet.  In fact the predecessor Heirloom
mailx did not normalize line endings if i recall correctly, ...
Yes, i changed this with (Rewrite file-content classification..,
2013-01-02, commit cacee1b57027a8fff), stating among others:

- Be more compliant to what the RFC states.  It seems that
  the former implementation was somewhat based upon mutt(1)
  code, but that doesn't seem to be very compliant either?
  Anyway, don't care no more for \f, but be aware of the
  explicitly forbidden \r's that are not part of a CRLF.

  In general handling of content tries to go for
  text/quoted-printable not binary/base64, i.e., not treating
  rather regular control characters as an indicator to use
  the latter.  I.e., if file(1)/libmagic(3) is the opinion
  something is text it doesn't seem useful to treat it as
  binary.

  As a nice side effect $-DOS files (those which use the
  terminal newline sequence in text files) are no longer
  binary data but are just treated the very way the RFC
  requires.  (Though the quoted-printable layer as of NOW is
  buggy and creates "buggy output" just as mutt(1) does.
  This will be fixed before the release, however.)

Well, hmhm.  What a mess.

Anyhow: what you want is the _explicit_ possibility to specify
that an attachment shall be treated as binary, no matter what?

Thanks for the suggestion, i will try to find a solution for it!
Until then there is not much you can do, unfortunately, except
maybe packing these files with ZIP or anything else that is
understood on the Windows receiver side?  (If you would have
control of the receiver side, you could install a MIME handler for
CSV, and automatically convert POSIX to terminal newline
sequences.)

Ciao John!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] viewing images

2022-09-17 Thread Steffen Nurpmeso
rb...@alumni.caltech.edu wrote in
 <202209171328.28hdsdrq020...@randytool.net>:
 | 'image/jpg; fbi -e -noverbose --autodown  %s; needsterminal'
 | This works - thanks.

Good to hear!
Good..

Ciao from Germany,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-17 Thread Steffen Nurpmeso
Hello Stephen.

(Why has all that become a private thread??  I'll CC mailx, ok?)

Stephen Isard wrote in
 <2704-1663371725-774...@sneakemail.com>:
 |On Fri, 16 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |> Isn't it much easier to write
 |>
 |>  set message-inject-tail=$'\nMoney\nGet back\nGrab that cash!'
 |>
 |> than to have a dedicated signature _file_?
 |
 |The colleague who mailed me about this has a twelve line signature file 
 |with lots of contact details.

Hm, ok, well that is .. hm.

 |Signature is clear.   message-inject-tail is complicated.

Except for groff caused copy+paste problems because it uses
symbols which do not map to the syntax elements we expect (hyphen
instead of hyphen-minus, whatever instead of single quote, etc);
The replacement should only be a copy+paste thing.
We will have this in the default nail.rc and the manual in v14.10

  #\define add_signature {
  #   \read version
  #   \echo '~< ~/.mysig' # or '~ I really want to have this go.
 |
 |Yes, I can tell :-)

We must shrink again.

 |> It is obsoloted for over half a decade, without anyone complaining 
 |> about it!
 |
 |But it has continued to work.  You might start to get complaints when 

But it is really noisy on the terminal.

 |it stops working and people are forced to read the manual and learn 
 |about splice macros.

I find the above not overly complicated.  No Stephen, if people
want to use S-nail and insert a signature file, the above five
lines will do it.

Sorry!  Greetings to America.

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Fwd: Re: signature

2022-09-16 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20220916232307.d3bwb%stef...@sdaoden.eu>:
 |..hm, i am about to evaluate what i press with these now..

Ah!  Oh!  They were private messages.


Sorry Stephen!!!


Time to go now, i think. :}

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] Fwd: Re: signature

2022-09-16 Thread Steffen Nurpmeso
..hm, i am about to evaluate what i press with these now..

--- Forwarded from Steffen Nurpmeso  ---
Date: Sat, 17 Sep 2022 01:17:30 +0200
Author: Steffen Nurpmeso 
From: Steffen Nurpmeso 
To: "Stephen Isard" 
Subject: Re: [S-mailx] signature
Message-ID: <20220916231730.go3bi%stef...@sdaoden.eu>
OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; 
url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt

Stephen Isard wrote in
 <2371-1663367648-862...@sneakemail.com>:
 |> I also rewrite splice hook docu with credits to you.
 |
 |Sure, that clarifies it (somewhat) for me, but really a new user who 
 |just wants to include a signature shouldn't have to take that in, even 
 |if they manage to find it.  Please don't remove the signature variable. 
 |Adding a signature is the only case of splicing that most users will 
 |ever care about and it ought to be straightforward.

Isn't it much easier to write

  set message-inject-tail=$'\nMoney\nGet back\nGrab that cash!'

than to have a dedicated signature _file_?

I really want to have this go.  It is obsoloted for over half
a decade, without anyone complaining about it!

Btw i first only used the standardized *sign* and *Sign*
variables.  They are in POSIX, they were in mailx of the 10th
edition, in 1991.  In fact i do it still, both, and then

  \set message-inject-tail=$sign

Really i want to have this go.  v14.10 will ship better examples,
also for message-inject-tail, with credit to you.

  ? set sign=$'\n  Tony'  Sign=$'\n  Tony\n  I am fixing things!'
  ? set message-inject-tail=${Sign}

Fix it again, Tony!
Ciao.
  ...
 -- End forward <20220916231730.go3bi%stef...@sdaoden.eu>

Almost prophetical.  hmhm

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


[S-mailx] Fwd: Re: signature

2022-09-16 Thread Steffen Nurpmeso
Sorry, somehow false keypress.

--- Forwarded from Steffen Nurpmeso  ---
Date: Sat, 17 Sep 2022 00:20:13 +0200
Author: Steffen Nurpmeso 
From: Steffen Nurpmeso 
To: "Stephen Isard" 
Subject: Re: [S-mailx] signature
Message-ID: <20220916222013.9o0q2%stef...@sdaoden.eu>
OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; 
url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt

Stephen Isard wrote in
 <1791-1663362752-327...@sneakemail.com>:
 |> Well the splice hooks run in a dedicated subprocess that can act
 |> "as if it were a user", so you basically have to echo the commands
 |> you want "the user" to run.  The process itself can only run
 |> a restricted set of commands itself (it is a separate process,
 |> say).
 |
 |I maintain that that is pretty fancy stuff and a user shouldn't have 
 |to get into it to include a signature.

Ah, it is not so bad.  And hopefully better now.
In the end this is not about:config!!
But thanks, yes, over the years i became even more idiotic than
i naturally am, good to hear other voices!!

(In fact there is a major rewrite of the manual going on _because
of that_, Ashton Fagg came over with critics, and i think the
first radical stretch, the first 51% of the manual, says vim,
improved language quite a bit: 3107 insertions(+), 3405
deletions(-).  But it is much too large, and it is not as easy as
clicking a button or two.  And then the program is so _incapable_
of doing things that it drives me up the wall.)

A nice weekend i wish, .. even to America!!
  ...
 -- End forward <20220916222013.9o0q2%stef...@sdaoden.eu>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-16 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20220916204431.ldtoq%stef...@sdaoden.eu>:
 ...

I also rewrite splice hook docu with credits to you.

 These hooks run after compose mode is finished, but before
 on-compose-leave[492].  Both are executed in a subprocess, with
 their input and output connected such that they can act like an
 interactive user: S-nail's output they read[252], input for
 S-nail they can echo[184].  Whereas the latter is a SHELL[638]
 command, the former is a define[173]d macro that is evaluated
 in a restricted mode with only a small set of commands avail-
 able (the verbose[611] output of for example list[219] indi-
 cates the `subprocess' capability).

 In the subprocess (a restricted set of) COMMAND ESCAPES[30]
 will always be available.  For guaranteed reproducibilities'
 sake escape[416] and ifs[444] are set to their defaults.  The
 escape ~^[320] has been especially designed for scriptability:
 the first line these hooks will read on standard input is the
 escape's protocol version ("0 0 2"), backward incompatible pro-
 tocol changes have to be expected.

 Care must be taken to avoid deadlocks and other false control
 flow: if subprocess and S-nail both wait for more input, or if
 one does not expect more input, whereas the other waits for
 consumption of its output.  Hooks are not automatically syn-
 chronized: if a hook emits `~x' to cause S-nail to exit compose
 mode, the subprocess will keep running nonetheless until the
 macro is completely worked or xit[309] is called explicitly.
 They will however receive a termination signal if the parent
 enters an error condition.  [v15 behaviour may differ] Protec-
 tion against and interaction with signals is not yet given; it
 is likely that in the future these scripts will be placed in an
 isolated session, which is signalled in its entirety as neces-
 sary.

Ciao!  And thanks (and sorry -- ach, i hate it!)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] oauth timeout

2022-09-16 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <472-1663353345-38...@sneakemail.com>:
 |On Fri, 16 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |> So for now there is _nothing_ you can do.
 |
 |That's what I suspected.  It's possible that the davmail thing that I 
 |mentioned last week takes care of renewing its tokens on time.  That 
 |could be the way to go.

Yes it is a pity.  Sorry!
I would need say 1/2 year or better twice as long where i can
really sit down and work in silence, consciously and dedicated,
six hours or more in a row, a day.  This is impossible here, too
much to do in the household, and with the animal friends an hour
away, back and forth.  I am (still) hoping we can leave for
a little piece of land in the south where it all comes together
_soon_.  But not yet, unfortunately.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-16 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <853-1663355387-506...@sneakemail.com>:
 |On Fri, 16 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |> Well ok but the manual includes a fully spelled out example for
 |> on-compose-splice:
 |>
 |>   define ocs_signature {
 |> read version
 |> echo '~< ~/.mysig' # '~}
 |>   set on-compose-splice=ocs_signature
 |
 |This works, but I don't actually understand how.  The man page says that 
 |'read' reads a line from standard input and assigns it to the given 
 |variable.  What is standard input going to be in this case?  Is it the 
 |output of echo?[.]

Well the splice hooks run in a dedicated subprocess that can act
"as if it were a user", so you basically have to echo the commands
you want "the user" to run.  The process itself can only run
a restricted set of commands itself (it is a separate process,
say).

 |[.]The given variable is 'version', which is read-only, so 
 |can't get assigned to.  What causes the quoted string to get evaluated?

Oops.  Well i think bitrot hammered into this one.  I'll fix it in
a second, thanks for noticing!  (And as above.)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] oauth timeout

2022-09-16 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <32464-1663350444-642...@sneakemail.com>:
 |It turns out that using on-main-loop-tick to check whether it is time to 
 |renew the auth token doesn't cover the case where you spend a long time 
 |writing a message in the external editor.  You come back from the editor 
 |to find that imap has timed out and there is no open folder.

Yes.
The main loop ticks whenever a mailx command can be entered.

 |Since I have defined an account for logging in with oauth, I should be 
 |able to give the command
 |account oauth
 |to reconnect.  However, I find that I have to issue the command twice. 
 |The first time, I just get a message that there is no open folder.

Well there is an old account that is now bogus.  That is one of
the problem with setting inbox aka folder to an IMAP account.
This software never got this right, Stephen, it needs the I/O and
MIME layer rewrite to get over all these problems.

 |Is there some way of trapping the imap disconnection error to trigger a 
 |new 'account oauth'?  I see code snippets involving 'trap' in the man 
 |page, but no entry for it in the list of commands.

No.  I _could_ add a hook in v14.10 that could be sprung in the
-keepalive- machinery, but that is in a signal handler, since that
is driven by ALARM yet.  That is the problem with this software...
One should always have a non-blocking event loop that only sleeps
sitting on select(2) (now *poll, kevent, or what), waiting for
events to happen.  Everything else is grazy.  If that is no good,
you need to separate UI and machinery, i think Rob Pike did so
first with the sam text editor in the early 80s.  With OAuth and
its hm user location tracking capabilities, at least for many
maybe the majority, that primitive way that Heirloom unfortunately
followed for at least mailx (the doctools are a different thing,
as far as i know).  Yes how often i said this, i should have
thrown it away, take the signal-clean minimal OpenBSD variant, and
then just take over what is necessary.  We would be at
a completely different level.  My fault.  I never overtook
maintainership of a wreck (that has had some great ideas).

I would normally suggest driving a cron job that then creates
shared credentials to be used by many programs, with S-nail only
picking up the latest when necessary.  I mean i _could_ hack some
concurrent loop in for v14.10 to drive this mess.  In fact
i rather hammered against a wall two years ago, because of all
this, OAUTH with its HTTP[123] / JSON / TIMEOUT mess.  Very user
unfriendly, almost fascist.  Is it.  You have even seen the web
interfaces these giant companies throw upon you.  I always said
Kerberos / kinit is much nicer.  The timeout problem is a bit
easier, at least.  The renewal is a lot so.

So for now there is _nothing_ you can do.  But driving an external
thing, via cron, or a simple backgrounded job.  It seems to me you
_could_ use the shell (`!') command within an account to create
a backgrounded thing, and on-account-cleanup to kill it.  This,
however, does not help with refreshing the credentials within
s-nail, within the open connection, of course.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-16 Thread Steffen Nurpmeso
Hello Stephen.

(..yaya i will look at modifying the fetchmail oauth thing for
s-nail in the upcoming days, next week thus likely..)

Stephen Isard wrote in
 <31588-1663344718-314...@sneakemail.com>:
 |Steffen,
 |
 |I don't use a signature myself, but a colleague who does recently 
 |updated his s-nail from the out of date version in the ubuntu repository 
 |and got a warning that signature was obsolete and he should use 
 |on-compose-leave and message-inject-tail.  That is, replace the single 
 |line
 |
 |signature=~/.signature
 |
 |whose meaning is pretty obvious to the ordinary user, with half a dozen 
 |lines of - if you will forgive my saying so - rather arcane low level 
 |code.  You shouldn't have to understand the semantics of "vput csop" 
 |to include a signature your emails.
 |
 |Please don't misunderstand. I think it is great that you have exposed 
 |low level workings of s-nail so that, for instance, someone who wants to 
 |include different signatures for different classes of recipients can 
 |arrange that.  But it shouldn't be at the expense of over-complicating 
 |everyday use.  Please retain the signature variable.

message-inject-tail.  signature loads a file.
Well ok but the manual includes a fully spelled out example for
on-compose-splice:

   define ocs_signature {
 read version
 echo '~< ~/.mysig' # '~MAILX)_TAIL.
With credits to you this "duplicating to the interactive terminal"
i removed.

I mean you can place multiline strings in v15-compat=y, and you
can `source' whatever file you want, for example

  $ cat .MYSIG
  set message-inject-tail=$'\nThe land returns to how it has always been\n\
  Thyme carried on the wind'
  $ MAILRC=$(pwd)/.MYSIG 

Re: [S-mailx] viewing images

2022-09-16 Thread Steffen Nurpmeso
Hello Mr. Bell.

rb...@alumni.caltech.edu wrote in
 <202209161411.28gebpax014...@randytool.net>:
 | I try to view images in s-mailx with fbi.  The .mailcap entry:
 |
 | image/jpg; fbi -e -noverbose --autodown  %s
 |
 |It pops the images up momentarily, too quickly to see, and fbi
 |reports:
 |
 | ioctl VT_GETMODE: Inappropriate ioctl for device
 | NOTICE: No vt switching available on terminal.
 | NOTICE: Not started from linux console?  CONFIG_VT=n?
 |
 |lynx uses the same .mailcap and works.  What's up with s-mailx?

Hm, lynx uses the ncurses library to drive the terminal i think,
whereas we drive it on our own, mostly.  You could try

  image/jpg; fbi -e -noverbose --autodown  %s; needsterminal

which maybe helps?

   This flag field indicates that the given shell command must be
   run on an interactive terminal.  S-nail will temporarily re-
   lease the terminal to the given command in interactive mode, in
   non‐interactive mode this entry will be entirely ignored; this
   flag implies x-mailx-noquote.

Framebuffer console!  I really loved it twenty years ago, when it
"suddenly was there" after installing a new Linux distro which
came with it!  Now that made me look, "by then" there was
a library noted in i think the Linux Magazin (Germany), and now
searching for it yes it was DirectFB, and that lead me to
DirectFB2 on github, and that reads: "2021-12-06 Revival of
DirectFB" !!  Hey!  Back in that day, i shortly dreamed of such an
environment!  Today i will not work without a graphical browser
here.  hm.

That reminded me that dire 13 months ago we had this with another
program, and i then also (beside needsterminal) said

  I also have CONFIG_VT_CONSOLE=y.

  P.S.: i was coming over
https://git.kraxel.org/cgit/fbida/tree/fbpdf.c#n324
  and
https://git.kraxel.org/cgit/fbida/tree/vt.c#n84
  in case that helps.

  Try adding VT_CONSOLE.

Did it help?  Hm.  Try "needsterminal".

Does this help?

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-12 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <2022091933.njtw7%stef...@sdaoden.eu>:
 |Stephen Isard wrote in
 | <23419-1663010880-528...@sneakemail.com>:
 ...
 ||You are right, calling it at the beginning of the account definition 
 ||works.  I didn't do it that way because I wasn't certain that s-nail 
 ||would set the password before attempting the imap login.  It makes sense 
 ||that the lines in the account definition would get executed in order, 
 ||but I wasn't sure.

'Added documentation snippet with credit to you.

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-12 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <23419-1663010880-528...@sneakemail.com>:
 |On Mon, 12 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |>|s-nail -X 'call update_access_token' -A oauth
 |>|
 |>|The initial call to update_access_token uses the refresh token in your
 |>|~/.s-nail-tokenfile to get an access token that s-nail treats as a
 |>|password for logging in.  The settings of on-main-loop-tick and
 |>
 |> Why do you need this initial call?  Ah, you directly log into IMAP
 |> and use that as your base, hmhm, we really deal bad with that.
 |> Call it from within the account?
 |
 |You are right, calling it at the beginning of the account definition 
 |works.  I didn't do it that way because I wasn't certain that s-nail 
 |would set the password before attempting the imap login.  It makes sense 
 |that the lines in the account definition would get executed in order, 
 |but I wasn't sure.

It will always work in this order, the old account is teared down,
the new account macro is evaluated, then if that was successful,
the folder is opened.  Maybe could also be documented better,
especially that on-account-cleanup is called even if the that
folder-opening stage is not even reached.

Thanks Stephen!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-12 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <11499-1662906146-906...@sneakemail.com>:
 |In case there is someone else in my situation, needing to connect to an 
 |institutional outlook account with s-nail, here is a recipe that works 
 |for me on ubuntu 20.04 LTS:

Thanks for this write-up, Stephen.

 |define update_access_token {
  ...
 |account oauth {
 | set inbox=imaps://yourname%40organizat...@outlook.office365.com
 | set folder=${inbox}
 | set user=loginname@organization #the name you log in with on their \
 | website
 | set from=emailname@organization # might be the same as user, or not

Really!?!  That is interesting, i added smtp-from (superceeding
smtp-hostname) to make this work on Microsoft, but it seems they
plugged it, as last week it did no longer work.

 | set mta=submission://smtp.office365.com
 | set smtp-use-starttls
 | set smtp-auth=oauthbearer
 | set imap-auth=oauthbearer
 ...
 |Now you can connect with
 |
 |s-nail -X 'call update_access_token' -A oauth
 |
 |The initial call to update_access_token uses the refresh token in your 
 |~/.s-nail-tokenfile to get an access token that s-nail treats as a 
 |password for logging in.  The settings of on-main-loop-tick and 

Why do you need this initial call?  Ah, you directly log into IMAP
and use that as your base, hmhm, we really deal bad with that.
Call it from within the account?

Yes it is a problem, on-main-loop-tick happens hm when the main
loop ticks, which it never does when only sending one mail
message.  on-compose-enter will get that thing.  Do you think it
would be a good idea to run it once in that case, too?  (For
simplicity etc.?  Document it better?)

  define mlt {
echo MLT
  }
  account x {
echo account x
  }
  define xx {
echo eins
echo zwei
xit
  }
  set emptystart
  set on-main-loop-tick=mlt on-compose-enter=mlt

comes to

  #?0|kent:nail.git$ MAILRC=/tmp/t.c mailx -:u -Ax -Xxit
  account x
  #?0|kent:nail.git$ MAILRC=/tmp/t.c mailx -:u -Ax -Yxit
  account x
  mailx version v14.9.24.  Type `?' for help
  /var/spool/mail/steffen: 0 messages
  No more mail.
  MLT
  #?0|kent:nail.git$ 

Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-06 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <18561-1662420543-345...@sneakemail.com>:
 |On Mon, 5 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |>|microsoft says it [basic authentication] will stop
 |>|working next month, which is why I am trying to set up
 |>
 |> They do?!
 |
 |They do.  See 
 |https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange\
 |-onl
 |ine/deprecation-of-basic-authentication-exchange-online

Thanks.  Microsoft instructions are pretty clear, but i will not
be able to do this today.

 |> I have no idea how to get an application ID for S-nail that can
 |> simply be used.
 |
 |Nor do I, but alpine has a fairly painless process for setting up 
 |xoauth2 for microsoft.  See 
 |https://alpineapp.email/alpine/alpine-info/misc/xoauth2.html (which 
 |starts off by explaining that "The idea of XOAUTH2 is to create the 
 |illusion of security").

Well i mean one thing there is with all this OAuth stuff, and that
is that services are capable to identify clients, and therefore
clients can be restricted in what they are allowed to do.  That is
not a bad thing.  Especially with future protocols like JMAP,
which will be able to drive the entire portfolio (mail, calendar,
whatever).  (Surely there are protocols which can do this already
today, of course.)
To me it is just that application specific passwords .. etc etc.
And couldn't it have been integrated via Kerberos, etc etc.

Thanks for the info.

Yes i mean with the scripts from [1,2] it is fairly easy with
s-nail, too.  I will not integrate it into s-nail itself, because
it needs HTTP, and -- this is what i said on an IETF list
regarding all this, too, after someone said something "you are
capable to do some HTTP, no?", in that spirit -- whereas HTTP 1.0
and 1.1 are easy, HTTP/2 is not even implemented by cURL, that
uses an external library, and that in turn uses two other
libraries to implement the QUIC variant, which is HTTP/3.

  [1] http://mmogilvi.users.sourceforge.net/software/oauthbearer.html
  [2] 
http://mmogilvi.users.sourceforge.net/downloads/oauthbearerScripts-2022-07-10.tar.bz2

My problem with it: if they want it, why not simply via some text
messages via TLS, even -- what i said -- in the protocol itself,
as an extension (just one back and forth it is), without JSON in
the protocol, but as simple text K=V\0 pairs?
But complaining does nothing to the actual reality, of course.

Anyhow i will not blow up S-nail with HTTP easy now, hard later.
And that "later" is soon given how they all hype QUIC at the
moment.

Granted: OpenSSL seems to implement its own QUIC driver, and since
we do need and yes want OpenSSL, we would get QUIC via it, and
then HTTP/[23] is possibly not that hard either.

And maybe cURL to unfortunately not do socket programming on our
own.

Yes.  So what you need is a client-id, and a client-secret, so
that the service can decide what is to be granted for you, and the
application you are actually using.

These are very complicated to get, impossible to accomplish for
Google in practice, except you let users go through a myriads of
complicated "developer" things.  Very user friendly.

Whereas i somehow failed to configure Microsoft in June last year,
and had lots of trouble with Google, i think it was because i use
firefox-bin, as the interface was incomplete and what the help
said i should use was simply not there!, it seems Alpine somehow
got all this, when i look at

  https://repo.or.cz/alpine.git/blob/HEAD:/alpine/xoauth2.h

i see

21 #define GMAIL_NAME (unsigned char *) "Gmail"
22 #define GMAIL_ID 
"624395471329-0qee3goofj7kbl7hsukou3rqq0igntv1.apps.googleusercontent.com"
23 #define GMAIL_SECRET "vwnqVJQrJZpR6JilCfAN5nY7"
24 #define GMAIL_TENANT NULL
25 #define GMAIL_FLAGS (OA2_AUTHORIZE)
26 
27 #define OUTLOOK_NAME (unsigned char *) "Outlook"
28 #define OUTLOOK_ID   "f21dcaf2-8020-469b-8135-343bfc35d046"
29 #define OUTLOOK_SECRET "Tk-DAcEi13-FeSsY_Ja4Y.-MyL66I.wIPt"
30 #define OUTLOOK_TENANT "common"
31 #define OUTLOOK_FLAGS (OA2_DEVICE)
32 
33 #define YANDEX_NAME  (unsigned char *) "Yandex"
34 #define YANDEX_ID "393578fee26f47858023cf59681882a7"
35 #define YANDEX_SECRET "7304c4993583498f8ab63e2f21ad6960"
36 #define YANDEX_TENANT NULL
37 #define YANDEX_FLAGS (OA2_AUTHORIZE)
38 
39 #define YAHOO_NAME   (unsigned char *) "Yahoo!"
40 #define YAHOO_ID 
"dj0yJmk9RTdyZEQ2TWxGMzV6JmQ9WVdrOWVrTllZbGgyV2tjbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTli"
41 #define YAHOO_SECRET "3a8b12d51c09b0a5c0733c36d04cd3c69e33baef"
42 #define YAHOO_TENANT NULL
43 #define YAHOO_FLAGS (OA2_AUTHORIZE)

so it seems to be doable to get client IDs and client secrets for
a console application for all these 

Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-05 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <16413-1662400928-384...@sneakemail.com>:
 |On Mon, 5 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |>|>|authenticating with xoauth2?
 |>|>
 |>|> The released S-nail's have oauthbearer which de facto _is_
 |>|> XOAUTH2.  No?  I think yes.
 |>|
 |>|Can you post the imap authentication settings for your fozzi-baer
 |>|account?  That would be very helpful.
 |>
 |> I actually do not have any.
 |
 |But aren't you then getting plain/basic/password authentication for 
 |imap, rather than xoauth2/oathbearer?  (I have no problem connecting 
 |with plain authentication at the moment, but microsoft says it will stop 
 |working next month, which is why I am trying to set up 

They do?!  I wished they would offer Kerberos, they use it anyway,
do they.

 |xoauth2/oathbearer.)

Like i said, with the helper scripts which do all the updates and
such we do support it, though falsely named.

I have no idea how to get an application ID for S-nail that can
simply be used.  For Google it is a _very_ expensive thing, and
they want things i simply cannot offer.  You could somehow make it
private, but the documentation does not match what i see when i go
there with firefox-bin.  Also i think it is forbidden to offer
public access to "private" applications.  Or whatever the term is.
We had a thread on that regarding Google in May i think.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-05 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <13488-1662383761-284...@sneakemail.com>:
 |On Mon, 5 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> Stephen Isard wrote in
 |> <3452-1662299186-348...@sneakemail.com>:
 ...
 |>|>  s-nail: >>> T9 LOGIN "fozzi-b...@outlook.com" "..."
 |>|>  s-nail: >>> SERVER: T9 OK LOGIN completed.
 |>|
 |>|authenticating with xoauth2?
 |>
 |> The released S-nail's have oauthbearer which de facto _is_
 |> XOAUTH2.  No?  I think yes.
 |
 |Can you post the imap authentication settings for your fozzi-baer 
 |account?  That would be very helpful.

I actually do not have any.

  account fozzi-baer {
 \call fozzi-baer
  }
  define fozzi-baer {
 \set hostname=outlook.com \
mta=submission://smtp.office365.com \
netrc-lookup \
tls-config-pairs=MinProtocol=TLSv1.2 \
    user=fozzi-b...@outlook.com
 \set smtp-from=$user \
from='Steffen Nurpmeso '

^ Ok this will not work out, i have not updated it on Saturday.
This all is v14.10.. 

 \shortcut pop '%:pop3s://outlook.office365.com'
 \shortcut imap '%:imaps://outlook.office365.com'
 \commandalias xp 'fi pop'
 \commandalias xi 'fi imap'
  }

I think this should choose default stuff all over the place.

Dear Stephen i am out of time .. tomorrow at latest i try to adapt
fozzi-baer to v14.9.24 and check it out.  (But.. i do not think
anything needs to be changed.  I mean, *smtp-from* does not exist
in v14.9.24.)  Ok?

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-05 Thread Steffen Nurpmeso
SZÉPE Viktor wrote in
 <20220904221036.horde.ags-xf3y3wwighnghqtb...@szepe.net>:
 |Hello folks!
 |
 |I'm not really into console based mailing. (maybe with v15 it will change!)
 |
 |In 2022 isn't it obvious that xoauth2 should be an integral part of  
 |your email client?
 |This is only my feeling. My 15 year old self hosted Horde webmail is  
 |also oauth-less.

Well there is

  Author: Steffen Nurpmeso 
  AuthorDate: 2019-09-08 03:12:08 +0200
  Commit: Steffen Nurpmeso 
  CommitDate: 2022-08-24 01:43:44 +0200

  [net-test] (BWDIC!) Extend authentication stuff, support automatic such..

  In order to finally "just work" (tm), to reduce the number of
  variables which need to be set to configure a single protocol, and
  also to require lesser code once it is possible to do the
  configuration also as part of an URL query string, rework the
  authentication stuff a bit.

  So with this we now have the framework to automatically handle
  AUTHentication, by parsing those mechanisms which the server
  supports, collate that with user wishes, and finally select the
  best mechanism in the current context.

  This also changes several other things:

  - Add XOAUTH2 authentication (at least as a name).
This is BWDIC!, because we falsely claimed OAUTHBEARER to be
XOAUTH2 in the past.
  - EXTERNAL and EXTERNANON require TLS.
  - OAUTHBEARER and XOAUTH2 require TLS.

But unfortunately so much is still missing for v14.10, it will not
happen before Christmas for sure.

It did

  case mx_CRED_AUTHTYPE_OAUTHBEARER:
  +   case mx_CRED_AUTHTYPE_XOAUTH2: /* TODO XOAUTH2 == OAUTHBEARER */
 f |= a_IS_OAUTHBEARER;
 /* FALLTHRU */
  case mx_CRED_AUTHTYPE_PLAIN:
  -   default: /* (this does not happen) */

   #define a_MAX \
  (2 + sizeof("AUTH XOAUTH2 " "user=\001auth=Bearer \001\001" NETNL))
...
if(f & a_IS_OAUTHBEARER){
   authfmt = NETLINE("AUTH XOAUTH2 %s");

so i am pretty sure it _was_ XOAUTH2.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-05 Thread Steffen Nurpmeso
Stephen Isard wrote in
 <3452-1662299186-348...@sneakemail.com>:
 |Thanks very much for the pointers, Steffen.  I don't actually need to 
 |use the microsoft smtp server.  There is another server that I can send 
 |through.  I just need to read mail on the imap server.  So is your 
 |report
 |
 |>  s-nail: >>> SERVER: * OK The Microsoft Exchange IMAP4 service is \
 |>  ready. ..
 |>  s-nail: >>> T8 CAPABILITY
 |>  s-nail: >>> SERVER: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2\
 |>   SAS$
 |>  s-nail: >>> SERVER: T8 OK CAPABILITY completed.
 |>  s-nail: >>> T9 LOGIN "fozzi-b...@outlook.com" "..."
 |>  s-nail: >>> SERVER: T9 OK LOGIN completed.
 |
 |authenticating with xoauth2?

The released S-nail's have oauthbearer which de facto _is_
XOAUTH2.  No?  I think yes.  v14.10 will detangle this to
oauthbearer and xoauth2, i am afraid configurations possibly need
to be changed.  Or not, since there will be a new *smtp-config*
which replaces all the others and automatically chooses a thing,
unless told otherwise.  But your console will be complain.

 |> But regarding your question, in the mutt(1) MUA repository there
 |> is contrib/mutt_oauth2.py*, and it reads
 |>
 |>  -- How to create a Microsoft registration --
 |...
 |
 |That looks promising.  I'll give it a try.
 |
 |Stephen Isard
 --End of <3452-1662299186-348...@sneakemail.com>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-03 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20220903225350.wezi7%stef...@sdaoden.eu>:
 ...
 |Hmm.  Well i can SMTP LOGIN as fozzi-baer, but can no longer send
 |a message as stef...@sdaoden.eu
 |
 |  554 5.2.252 SendAsDenied; fozzi-b...@outlook.com not allowed to send \
 |  as stef...@sdaoden.eu; STOREDRV.Submission.Exception:SendAsDeniedExcepti\
 |  on.MapiExceptionSendAsDenied; Failed to process message due to a \
 |  permanent exception with message [BeginDiagnosticData]Cannot submit \
 |  message.

They now not only test the "MAIL FROM:<>" that can be "set
smtp-from=X" (since some time), they also check for "set from=Y"
now!  Spoiler alarm.  But if i "set from=$smtp-from" (aka $user):

  #?0|kent:src$ >> Date: Sun, 04 Sep 2022 00:56:22 +0200
  s-nail: >>> Author: fozzi-b...@outlook.com
  s-nail: >>> From: fozzi-b...@outlook.com
  s-nail: >>> To: stef...@sdaoden.eu
  s-nail: >>> Subject: Test without XOAUTH2
  s-nail: >>> Message-ID: <20220903225622.k2gjf...@outlook.com>
  s-nail: >>> User-Agent: s-nail v14.9.24-295-g629abc8b54
  s-nail: >>>
  s-nail: >>> .
  s-nail: >>> QUIT
  s-nail: >>> SERVER: 250 2.0.0 OK ...
  s-nail: >>> SERVER: 221 2.0.0 Service closing transmission channel

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] microsoft outlook server with xoauth2

2022-09-03 Thread Steffen Nurpmeso
Hello Stephen!

Sorry, late and tired..  But..

Stephen Isard wrote in
 <29100-1662236093-605...@sneakemail.com>:
 |A university mail server that I use was outsourced to microsoft.  I have 

I truly hate that outsourcing everywhere.  A few years back
a university of Vienna/Austria outsourced to GMail i think, then
i stopped complaining, but now that you come in.  aaeehh.  It is
likely the easy integration of calendars and mail and anything.
We had that Univention Corporate Server thing in Germany, but hey
this is a business, sorry for mentioning it.  It drives some
public schools anyhow.  Sifh.

 |been connecting to this server in s-nail using "plain" authentication, 
 |i.e., a password.  Now microsoft is about to stop supporting plain 
 |authentication 
 |https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange\
 |-online/deprecation-of-basic-authentication-exchange-online 
 |and it will be necessary to use xoauth2.  I have read the s-nail man 
 |page section "But, how about XOAUTH2 / OAUTHBEARER?" and can copy the 
 |oauth2.py stuff, but I don't know the microsoft equivalents to the gmail 
 |instructions for getting and storing the “client ID” and “client secret” 
 |given in 
 |https://github.com/google/gmail-oauth2-tools/wiki/OAuth2DotPyRunThrough.

For Google use [1], that works instead.  Aka [2], which i plan to
somehow integrate into s-nail v14.10, whenever that happens
(christmas).  (I have not looked in [2] yet, i read more in detail
over the 2020-11-03 version.  It seems to be a 1518 line diff.)

  [1] http://mmogilvi.users.sourceforge.net/software/oauthbearer.html
  [2] 
http://mmogilvi.users.sourceforge.net/downloads/oauthbearerScripts-2022-07-10.tar.bz2

 |Has anyone been connecting to an outlook account using xoauth2 with 
 |s-nail?  Steffen, did you try to use xoauth2 with your fozzi-baer 
 |account?

Oh i have even forgotten i have this account.
Hmm, login works for me still.

  s-nail: >>> SERVER: * OK The Microsoft Exchange IMAP4 service is ready. ..
  s-nail: >>> T8 CAPABILITY
  s-nail: >>> SERVER: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 
SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
  s-nail: >>> SERVER: T8 OK CAPABILITY completed.
  s-nail: >>> T9 LOGIN "fozzi-b...@outlook.com" "..."
  s-nail: >>> SERVER: T9 OK LOGIN completed.

But regarding your question, in the mutt(1) MUA repository there
is contrib/mutt_oauth2.py*, and it reads

  -- How to create a Microsoft registration --

  Go to portal.azure.com, log in with a Microsoft account (get a free
  one at outlook.com), then search for "app registration", and add a
  new registration. On the initial form that appears, put a name like
  "Mutt", allow any type of account, and put "http://localhost/; as
  the redirect URI, then more carefully go through each
  screen:

  Branding
   - Leave fields blank or put in reasonable values
   - For official registration, verify your choice of publisher domain
  Authentication:
   - Platform "Mobile and desktop"
   - Redirect URI "http://localhost/;
   - Any kind of account
   - Enable public client (allow device code flow)
  API permissions:
   - Microsoft Graph, Delegated, "offline_access"
   - Microsoft Graph, Delegated, "IMAP.AccessAsUser.All"
   - Microsoft Graph, Delegated, "POP.AccessAsUser.All"
   - Microsoft Graph, Delegated, "SMTP.Send"
   - Microsoft Graph, Delegated, "User.Read"
  Overview:
   - Take note of the Application ID (a.k.a. Client ID), you'll need it shortly

  End users who aren't able to get to the app registration screen within
  portal.azure.com for their work/school account can temporarily use an
  incognito browser window to create a free outlook.com account and use that
  to create the app registration.

  Edit the client_id (and client_secret if there is one) into the
  mutt_oauth2.py script.

And use the above script instead.  I tried to use mutt_oauth2.py
with Microsoft, but failed.  That was in June 2021 however.

Well i did that a year ago, but could not get SMTP to work if
i recall correctly, and then they blocked my account because
i said "Microsoft, please" in a test message, which was against
their policy.  Ozzy Osbourne wants to leave, saying "This is not
America no more" or something in that spirit.  Impossible to
imagine that in America Bianca Jagger was sitting on a horse, and
the guy with the big penis (Hugo?!) was naked.  2.5.1977.

Hmm.  Well i can SMTP LOGIN as fozzi-baer, but can no longer send
a message as stef...@sdaoden.eu

  554 5.2.252 SendAsDenied; fozzi-b...@outlook.com not allowed to send as 
stef...@sdaoden.eu; 
STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; 
Failed to process message due to a permanent exception with message 
[BeginDiagnosticData]Cannot submit message.

I am too tired to look into this now.  Poor Stephen that has to
use Microsoft.
But the above hopefully helps, and the script is really good and
easy to use.

Please report back on problems, Stephen!

Re: [S-mailx] bad timestamp in case of gmtoff%60!=0

2022-08-06 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20220801174659.5kp1a%stef...@sdaoden.eu>:
 |Arne Wörner wrote in
 | :
 ||On 2022-08-01T16:37:16TAI, Steffen Nurpmeso wrote:
 ||> So why don't you come over with something understandable directly.
 ||>
 ||I thought i did...
 ...
 |I will implement that, thanks for the report!
 |(Currently busy, will report back once done!)

So i hope the [next] branch has the necessary changes, we will
switch to UTC (via -) when producing the Date: field and there
is a sub-minute mismatch.
I gave you credit via the above address, please complain if that
is not ok!

Ciao, and a nice Sunday (if possible) everybody!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bad timestamp in case of gmtoff%60!=0

2022-08-01 Thread Steffen Nurpmeso
Arne Wörner wrote in
 :
 |On 2022-08-01T16:37:16TAI, Steffen Nurpmeso wrote:
 |> So why don't you come over with something understandable directly.
 |>
 |I thought i did...

  https://mailarchive.ietf.org/arch/msg/emailcore/OEwxOYEabI518_0m7r9vO57O0HI/

I will implement that, thanks for the report!
(Currently busy, will report back once done!)

Ciao

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bad timestamp in case of gmtoff%60!=0

2022-08-01 Thread Steffen Nurpmeso
Hello Arne.

..but on the list is better indeed.

Arne Wörner wrote in
 :
 |On 2022-07-28T17:15:02TAI, Steffen Nurpmeso wrote:
 |>|when I send an email with /bin/mail at 2022-07-28T04:48:54+00:00:37,
 |>|then s-mailx writes:
 |>|Date: Thu, 28 Jul 2022 04:48:54 +
 |> 
 |> And what did you expect?
 |>
 |exim would convert the timestamp to UTC and
 |write "Date: Thu, 28 Jul 2022 04:48:17 +"...

Well .. i had to look, but i hardly can imagine that exim applies
any special massage there.  You normally use the standard
functions gmtime(3) and localtime(3) for these things, or you link
against a special library which does such, i *think* ICU offers
data and time conversion too, but i only looked a little bit, and
a decade has passed since.  And localtime(3), on Linux, usually
works according to /etc/localtime.

 |> What is it that i should fix?
 |> 
 |I would find it cool, if s-mailx could detect that situation itself.
 |But of course I can use my wrapper script, too...
 |The question is, if s-mailx should mention,
 |that it cannot produce an RFC5322-compliant timestamp in the TAI zone.

How should i detect this?  We use the localtime(3) function for
local time, and the gmtime(3) function for GMT.
Doing this all on our own is a very hard thing to do, you need to
be able to parse all forms of the $TZ environment variable, and
you need to get a portable notion of where to get the zone name
from otherwise (like readlink(2) /etc/localtime).

Apart from that i personally am total opposed to dropping leap
seconds and solar time.  CLOCK_TAI for programming purposes ok,
but a TAI time zone?  I do not even own a watch.

 |> If it is that you want some standard to include CLOCK_TAI, oh yes,
 |> that i would love to see myself.  Much better than fiddling around
 |> with the link of civil time to solar time.  But CLOCK_TAI is not
 |> that widely supported, nor are the mechanisms in the kernel
 |> everywhere.  :(
 |>
 |We do not need CLOCK_TAI...

Better it would be.

 |I think my zoneinfo file makes fiddling around with 61-second long \
 |minutes unnecessary,
 |because: There are no such minutes in TAI zone...

So then.  And exim fits that perfect environment?

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] bad timestamp in case of gmtoff%60!=0

2022-07-28 Thread Steffen Nurpmeso
Hello Arne.

Arne Wörner wrote in
 :
 |When I use this timezone file (http://www0.wgboome.org/zoneinfo-TAI.tar.\
 |xz), and

Oh no, i do not look in that!

 |when I send an email with /bin/mail at 2022-07-28T04:48:54+00:00:37,
 |then s-mailx writes:
 |Date: Thu, 28 Jul 2022 04:48:54 +

And what did you expect?

 |Workaround: I wrote I wrapper, which seems to help...
 |
 |# cat /bin/mail
 |#!/bin/sh
 |TZ=UTC /bin/mail,orig $@
 |
 |Can u fix it somehow inside the binary?

What is it that i should fix?

 |Maybe 2 further timezone offset digits are compliant?
 |
 |Or s-mailx just writes the timezone name (in this case "TAI" without \
 |brackets) and omits the "%z"?
 |
 |Or s-mailx changes the timezone to UTC internally, when it detects \
 |that gmtoff%60 is not zero?
 |Btw: That is what exim does (in my understanding), since i pointed \
 |it out...

I must say i have problems to parse this.
E-Mails use a standardized format, the "Internet Message Format",
RFC 5322 (is the newest).  There in section "3.3.  Date and Time
Specification" you will find

  zone=   (FWS ( "+" / "-" ) 4DIGIT) / obs-zone

and this is exactly what we are doing.

   The zone specifies the offset from Coordinated Universal Time (UTC,
   formerly referred to as "Greenwich Mean Time") that the date and
   time-of-day represent.  The "+" or "-" indicates whether the time-of-
   day is ahead of (i.e., east of) or behind (i.e., west of) Universal
   Time.  The first two digits indicate the number of hours difference
   from Universal Time, and the last two digits indicate the number of
   additional minutes difference from Universal Time.  (Hence, +hhmm
   means +(hh * 60 + mm) minutes, and -hhmm means -(hh * 60 + mm)
   minutes).  The form "+" SHOULD be used to indicate a time zone at
   Universal Time.  Though "-" also indicates Universal Time, it is
   used to indicate that the time was generated on a system that may be
   in a local time zone other than Universal Time and that the date-time
   contains no information about the local time zone.

If it is that you want to see "TAI" in the above, zone names have
long been obsoleted, and only a restricted set is to be
understood for compatibility reasons (if at all).  Furthermore

   Other multi-character (usually between 3 and 5) alphabetic time zones
   have been used in Internet messages.  Any such time zone whose
   meaning is not known SHOULD be considered equivalent to "-"
   unless there is out-of-band information confirming their meaning.

And this not.

If it is that you want some standard to include CLOCK_TAI, oh yes,
that i would love to see myself.  Much better than fiddling around
with the link of civil time to solar time.  But CLOCK_TAI is not
that widely supported, nor are the mechanisms in the kernel
everywhere.  :(

Ciao?

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] why s-nail contains the build info

2022-07-27 Thread Steffen Nurpmeso
Hey,

Steffen Nurpmeso wrote in
 <20220727153802._gh84%stef...@sdaoden.eu>:
 |Yu, Mingli wrote in
 | <53fa174d-64f0-183e-5ea9-d027a3faa...@windriver.com>:
 ||Actually I'm just wondering how to make the binary /usr/bin/s-nail not 
 ||include the below info.
 ...
 |I will add configuration for that today, something like
 ...

With credits to you

  # Optional, for packagers who do not want to include build information
  # in the binary: if set non-empty this ends up in the INTERNAL VARIABLES
  # *build-rest*, and *build-cc* as well as *build-ld* will be empty.
  # Please set your own VAL_CONTACT_{MAIL,WEB} if you set this, and/or
  # include enough information to make bug reports linkable to package
  # recipes and the used build environment.
  VAL_BUILD_INFO=

I hope this helps,
Ciao from Germany,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


  1   2   3   4   5   6   7   >