Hello Martin.

Martin T wrote in <CAJx5YvHz9-sxNobMHSePqgFZS0pSN==j0Nt_+sodCSpbO=h5JQ@m\
ail.gmail.com>:
 |I'm using an apt-listchanges tool which extracts the Debian package
 |changelog and NEWS files during the installation of a new version of a
 |package. This information is sent to e-mail in apt-listchanges
 |apt_listchanges.py script like this:
 |
 |try:
 |  subprocess.run(['/usr/sbin/sendmail', '-oi', '-t'],
 |input=message.as_bytes(), check=True)
 |
 |As I want to use mail/mailx with remote MTA(smtp.gmail.com) instead of
 |sendmail and I would like to avoid modifying the apt_listchanges.py
 |script, then I made a following simple wrapper:
 |
 |$  cat /usr/sbin/sendmail
 |#!/usr/bin/env bash
 |
 |/usr/bin/mailx -vvv -t
 |$
 |
 |It works fine except some headers like "Auto-Submitted:" or
 |"MIME-Version:" are unknown for mailx and ignored, but most
 |importantly, the "Subject:" field is quoted-printable(?) encoded:

It seems you feed in readily prepared MIME mails.  This is
unfortunately not yet supported, the software has historically
grown to use two distinct execution paths, and the -t (and -m) one
cannot, sorry.  It is part of the v15 rewrite to change this.
I can add your name to the persons to be credited for this feature
by then. :(

You could possibly find satisfaction with DMA (DragonFly Mail
Agent), a very small MTA with send queue which can send to smart
hosts (e.g., GMail)with send queue.  Or with MSMTP, it now also
seems to have a queue.  (I have never used the latter.  The former
i use actively on my work machine for years.)

With this MUA all you could do today is to save the message in
a file, and then either `forward' or `resend' the message to the
desired location.  For this the file needs a so-called From_ line,
because S-nail want to open a MBOX file, now a raw message:

  #!/bin/sh -

  TARGET=t...@exam.ple

  tf=`mktemp`
  trap "rm \"$tf\"" EXIT

  {
    echo 'From MAILER-DAEMON Wed Oct  2 01:50:07 1996'
    cat
  } >> "$tf"

  printf 'resend %s\n' "$TARGET" | s-nail -#Rf -d "$tf"

 |READ 63 bytes <Subject: =?utf-8?q?apt-listchanges=3A_changelogs_for_vps?=>
 |
 |..and Gmail shows the literal
 |"=?utf-8?q?apt-listchanges=3A_changelogs_for_vps?=" string as an
 |e-mail subject. Is this my mailx configuration mistake? Or the mailx
 |itself behaves incorrectly? Or is it indeed the Gmail which does not
 |understand, that it should decode this subject?
 |
 |I would happily simply override the "Subject:" header value with "-s",
 |but I guess this is not possible because manual says that "If a
 |message subject is specified via ‘Subject:’ then it will be used in
 |favour of one given on the command line."

No, i am sorry.  This code path just does not know anything about
readily prepared mail messages, it assumes a plain text body and
optionally supports some (raw, plain text) header fields.
And unfortunately the underlaying problem is deep in the design.
Having said that, i have never tried mutt and its -x mode, maybe
that can also what you are looking for.  This little MUA here will
need at least two more years until we get there.

Sorry!
And 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)

Reply via email to