• Re: Sending mail from command line

    From Dan Espen@21:1/5 to Janis Papanagnou on Wed Jan 26 09:39:01 2022
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

    Decades ago I used (on AIX) the 'mailx' command to automatically send notifications from cron'd shell scripts per email, something like

    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Two questions:
    * Where do I have to look (or what to do)[*] to fix that problem?
    * Is there some other (preferred, simpler, or without crypto demands)
    interface or tool to send emails automatically from a shell script?

    Thanks for any insights.

    It's not email, but notify-send works if you want the message routed to
    the desktop.

    --
    Dan Espen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to All on Wed Jan 26 15:20:04 2022
    Decades ago I used (on AIX) the 'mailx' command to automatically send notifications from cron'd shell scripts per email, something like

    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Two questions:
    * Where do I have to look (or what to do)[*] to fix that problem?
    * Is there some other (preferred, simpler, or without crypto demands)
    interface or tool to send emails automatically from a shell script?

    Thanks for any insights.

    (References to more appropriate newsgroups are also welcome.)

    Janis

    [*] I've heard that sendmail configuration is a nightmare.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Janis Papanagnou on Wed Jan 26 14:59:11 2022
    On Wed, 26 Jan 2022 15:20:04 +0100, Janis Papanagnou wrote:

    [snip]
    [*] I've heard that sendmail configuration is a nightmare.

    Sendmail configuration is indeed complex, mostly due to the
    archaic form of it's configuration file, and the variety of options
    available for mail handling.

    However, depending on your distro, your installation may have come
    with one or more sample configurations, most of which are relatively
    easy to modify for use.

    I personally run sendmail as my public MTA, with some custom config
    changes to handle miltering (raw email filtering) and secured outbound
    email relaying (through my ISP's MTA). My sendmail.mc file runs 22 lines (excluding comments), and only differs from my distro's stock sendmail.mc
    by 4 lines.

    FWIW, I can recommend
    "sendmail"
    by Bryan Costales with Eric Allman
    O'Reilly & Associates
    ISBN 1-56592-222-0
    as a /really/ good book on the subject, and
    "sendmail Cookbook"
    by Craig Hunt
    O'Reilly & Associates
    ISBN 0-596-00471-0
    as a good guide to some common (and uncommon) configuration requirements.

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Fenris on Wed Jan 26 17:12:22 2022
    On 26.01.2022 16:36, Fenris wrote:
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron
    involved here.

    Thanks also for the other replies thus far.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fenris@21:1/5 to Janis Papanagnou on Wed Jan 26 15:36:42 2022
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Dan Espen on Wed Jan 26 17:21:49 2022
    On 26.01.2022 15:39, Dan Espen wrote:
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

    Decades ago I used (on AIX) the 'mailx' command to automatically send
    notifications from cron'd shell scripts per email, [...]

    It's not email, but notify-send works if you want the message routed to
    the desktop.

    I've also thought about such an alternative, e.g. I had used 'zenity'
    (a similar tool) for notifications in one case before.

    An email interface would open a broader applicability, though, thus
    still searching...

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lew Pitcher on Wed Jan 26 17:24:09 2022
    On 26.01.2022 15:59, Lew Pitcher wrote:
    On Wed, 26 Jan 2022 15:20:04 +0100, Janis Papanagnou wrote:

    [snip]
    [*] I've heard that sendmail configuration is a nightmare.

    Sendmail configuration is indeed complex, mostly due to the
    archaic form of it's configuration file, and the variety of options
    available for mail handling.
    [...]

    My preference would be to not have to touch it, if avoidable.

    Working tools solutions would certainly be nice, if existing.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Janis Papanagnou on Wed Jan 26 16:29:58 2022
    On Wed, 26 Jan 2022 17:12:22 +0100, Janis Papanagnou wrote:

    On 26.01.2022 16:36, Fenris wrote:
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron involved here.

    Thanks also for the other replies thus far.

    Janis

    From what I've been able to gather, mailx(1) invokes sendmail(1) under
    the covers. On my Slackware system, mailx(1) /does not/ have any hardcoded references to gnome-keyring, or any other keyring, for that matter.

    I do note that the mailx(1) manpage states:
    Sending mail from scripts
    If you want to send mail from scripts, you must be aware that mailx
    reads the user's configuration files by default. So unless your script
    is only intended for your own personal use (as e.g. a cron job), you
    need to circumvent this by invoking mailx like

    MAILRC=/dev/null mailx -n

    You then need to create a configuration for mailx for your script.
    This can be done by either pointing the MAILRC variable to a custom
    configuration file, or by passing the configuration in environment
    variables. Since many of the configuration options are not valid shell
    variables, the env command is useful in this situation. An invocation
    could thus look like

    env MAILRC=/dev/null from=scriptreply@domain smtp=host \
    smtp-auth-user=login smtp-auth-password=secret \
    smtp-auth=login mailx -n -s "subject" \
    -a attachment_file recipient@domain <content_file

    Perhaps the default MAILRC for /your/ invocation of mailx(1) contains some reference to a cryptographic signature that, as a byproduct, attempts to invoke the system keyring to determine the proper keys. This is where I'd start looking.

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John-Paul Stewart@21:1/5 to Janis Papanagnou on Wed Jan 26 11:28:05 2022
    On 2022-01-26 09:20, Janis Papanagnou wrote:
    Decades ago I used (on AIX) the 'mailx' command to automatically send notifications from cron'd shell scripts per email, something like

    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Two questions:
    * Where do I have to look (or what to do)[*] to fix that problem?
    * Is there some other (preferred, simpler, or without crypto demands)
    interface or tool to send emails automatically from a shell script?

    Be aware that on Ubuntu, "sendmail" may not actually be the original
    sendmail program. Almost all Message Transfer Agents (MTAs) install a /usr/bin/sendmail program or symlink. I believe the default on Ubuntu
    is actually Postfix.

    I use Debian with (the default) Exim as the MTA, and mailx has always
    worked out of the box for me. No gnome-keyring involved. So your
    problem might be specific to Ubuntu.

    Either alt.os.linux.ubuntu or comp.os.linux.misc might have more answers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christoph Brinkhaus@21:1/5 to Janis Papanagnou on Wed Jan 26 16:43:03 2022
    Janis Papanagnou <janis_papanagnou@hotmail.com> schrieb:
    On 26.01.2022 16:36, Fenris wrote:
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

    Hello Janis!

    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron involved here.

    I have two points.

    a) How does "normal" mail sending works?
    Does it invoke sendmail?
    I guess not. Otherwise you should observe the same errors.

    b) More and more mail provider insist on encrypted transport.
    May be in the past the sendmail configuration regarding encryption
    has never been invoked. But now it is a problem.

    You could consider to use more simple replacements for sendmail.
    One is msmtp just for outgoing mail to a smart host.
    Please see https://wiki.debian.org/msmtp for an overview.
    It lists also alternatives.

    The Dragonfly Mail Agent dma is also a simple
    sendmail replacement. I am not sure if there is a Debian or Ubuntu
    package.

    I think the easiest approach is to start with msmtp or similar.

    Kind regards,
    Christoph

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to Janis Papanagnou on Wed Jan 26 17:00:38 2022
    On 26/01/2022 14:20, Janis Papanagnou wrote:
    Decades ago I used (on AIX) the 'mailx' command to automatically send notifications from cron'd shell scripts per email, something like

    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Two questions:
    * Where do I have to look (or what to do)[*] to fix that problem?
    * Is there some other (preferred, simpler, or without crypto demands)
    interface or tool to send emails automatically from a shell script?

    Thanks for any insights.

    (References to more appropriate newsgroups are also welcome.)

    Janis

    [*] I've heard that sendmail configuration is a nightmare.


    Do you want to send mail to your real email address janis_pxxxxxxxx@hotmail.com?
    Or just to your local user?
    For the first look at https://github.com/deanproxy/eMail

    --
    Chris Elvidge
    England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fenris@21:1/5 to Janis Papanagnou on Wed Jan 26 16:33:37 2022
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron involved here.

    Maybe running `killall gnome-keyring-daemon' before the command?

    Just to approach that "gnome-keyring" is the problem but not sendmail etc.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John-Paul Stewart@21:1/5 to Janis Papanagnou on Wed Jan 26 12:28:09 2022
    On 2022-01-26 11:12, Janis Papanagnou wrote:
    On 26.01.2022 16:36, Fenris wrote:
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11:
    No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron involved here.

    In that case, check your environment for any GNOME_KEYRING_* variables.
    If there are any, unset them and re-try your mailx command.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to John-Paul Stewart on Wed Jan 26 19:00:56 2022
    On 26.01.2022 18:28, John-Paul Stewart wrote:
    On 2022-01-26 11:12, Janis Papanagnou wrote:
    On 26.01.2022 16:36, Fenris wrote:
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11: >>>> No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron
    involved here.

    In that case, check your environment for any GNOME_KEYRING_* variables.
    If there are any, unset them and re-try your mailx command.

    There are two such variables. Clearing or unset'ing them for the mailx
    command has no effect, though; same error...

    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Unruh@21:1/5 to Lew Pitcher on Wed Jan 26 17:48:59 2022
    On 2022-01-26, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    On Wed, 26 Jan 2022 15:20:04 +0100, Janis Papanagnou wrote:

    [snip]
    [*] I've heard that sendmail configuration is a nightmare.

    Sendmail configuration is indeed complex, mostly due to the
    archaic form of it's configuration file, and the variety of options
    available for mail handling.

    Many distributions now use postfix as the mail sender/receiver, not
    sendmail. It has a "sendmail" stub to make software think that it is
    sendmail that is being used. Check what you are using first.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Unruh@21:1/5 to Janis Papanagnou on Wed Jan 26 18:18:56 2022
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    On 26.01.2022 18:28, John-Paul Stewart wrote:
    On 2022-01-26 11:12, Janis Papanagnou wrote:
    On 26.01.2022 16:36, Fenris wrote:
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote: >>>>> mailx -s "Test results" me@my.domain.invalid <<EOT
    message to deliver
    ...
    EOT

    Now on Linux/Ubuntu I get that error

    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-.../pkcs11: >>>>> No such file or directory
    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Very strange. Maybe some unusual crontab variables set?

    This error was just the result of a try from the command line, no cron
    involved here.

    In that case, check your environment for any GNOME_KEYRING_* variables.
    If there are any, unset them and re-try your mailx command.

    There are two such variables. Clearing or unset'ing them for the mailx command has no effect, though; same error...

    send-mail: Authorization failed (535 Incorrect authentication data)
    Can't send mail: sendmail process failed with error code 1

    Figure out what your MTA (Mail transfer agent) is. Is it really sendmail, or is it something
    like postfix?
    Eg on my system (Mageia not Ubuntu):

    tunnel:1.0[unruh]>l /sbin/sendmail
    lrwxrwxrwx 1 root root 34 Apr 12 2019 /sbin/sendmail -> /etc/alternatives/sendmail-command
    l /etc/alternatives/sendmail-command
    lrwxrwxrwx 1 root root 26 Apr 12 2019 /etc/alternatives/sendmail-command -> /usr/sbin/sendmail.postfix

    (l is an alias for ls -la)


    Does regular mail work? What do you use as your normal mailer-- not
    mailx I presume. What MTA does it use? It is still working?





    Janis


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to William Unruh on Wed Jan 26 20:30:33 2022
    On 26.01.2022 19:18, William Unruh wrote:

    Figure out what your MTA (Mail transfer agent) is. Is it really sendmail, or is it something
    like postfix?
    Eg on my system (Mageia not Ubuntu):

    tunnel:1.0[unruh]>l /sbin/sendmail
    lrwxrwxrwx 1 root root 34 Apr 12 2019 /sbin/sendmail -> /etc/alternatives/sendmail-command
    l /etc/alternatives/sendmail-command
    lrwxrwxrwx 1 root root 26 Apr 12 2019 /etc/alternatives/sendmail-command -> /usr/sbin/sendmail.postfix

    /usr/sbin/sendmail -> ssmtp

    The latter is an executable file.


    Does regular mail work? What do you use as your normal mailer-- not
    mailx I presume. What MTA does it use? It is still working?

    Yes, as the standard email application I use a Thunderbird client.
    As outgoing server there's one at my ISP defined, dedicated to my
    account; I haven't configured anything else when I had set it up.

    Thinking about it; how would 'mailx' know that outgoing server?
    It must be defined somewhere, I suppose.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Janis Papanagnou on Wed Jan 26 19:45:36 2022
    On Wed, 26 Jan 2022 20:30:33 +0100, Janis Papanagnou wrote:

    On 26.01.2022 19:18, William Unruh wrote:

    Figure out what your MTA (Mail transfer agent) is. Is it really sendmail, or is it something
    like postfix?
    Eg on my system (Mageia not Ubuntu):

    tunnel:1.0[unruh]>l /sbin/sendmail
    lrwxrwxrwx 1 root root 34 Apr 12 2019 /sbin/sendmail -> /etc/alternatives/sendmail-command
    l /etc/alternatives/sendmail-command
    lrwxrwxrwx 1 root root 26 Apr 12 2019 /etc/alternatives/sendmail-command -> /usr/sbin/sendmail.postfix

    /usr/sbin/sendmail -> ssmtp

    The latter is an executable file.


    Does regular mail work? What do you use as your normal mailer-- not
    mailx I presume. What MTA does it use? It is still working?

    Yes, as the standard email application I use a Thunderbird client.
    As outgoing server there's one at my ISP defined, dedicated to my
    account; I haven't configured anything else when I had set it up.

    Thinking about it; how would 'mailx' know that outgoing server?
    It must be defined somewhere, I suppose.

    mailx (a MUA, or "Mail User Agent") hands it's outgoing email to
    postfix (a MTA, or "Mail Transfer Agent") by forking off a child
    that runs "sendmail" (in your case, a softlink to postfix).

    This sendmail/postfix child process passes the email on to the
    next MTA (usually, the email MTA daemon running on your network),
    which, in turn, passes the email onward to the receiver. Note that
    the postfix child process /can/ transfer the email onward towards
    the recipient(s) without a local email MTA daemon.

    If you haven't configured postfix to relay email via your ISP's
    email server, then it likely tries to deliver the email directly.
    Check your system's /etc/postfix/main.cf configuration file for
    all the gruesome details.

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lew Pitcher on Wed Jan 26 22:41:31 2022
    On 26.01.2022 20:45, Lew Pitcher wrote:

    If you haven't configured postfix to relay email via your ISP's
    email server, then it likely tries to deliver the email directly.
    Check your system's /etc/postfix/main.cf configuration file for
    all the gruesome details.

    Hmm.. - beneath /etc I neither found a file or directory named
    postfix nor a file main.cf.

    Janis

    PS: I haven't yet worked through all the posted suggestions and
    hints, so I still have to do some homework here...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Jackson@21:1/5 to Janis Papanagnou on Wed Jan 26 22:13:35 2022
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    On 26.01.2022 20:45, Lew Pitcher wrote:

    If you haven't configured postfix to relay email via your ISP's
    email server, then it likely tries to deliver the email directly.
    Check your system's /etc/postfix/main.cf configuration file for
    all the gruesome details.

    Hmm.. - beneath /etc I neither found a file or directory named
    postfix nor a file main.cf.

    Janis

    PS: I haven't yet worked through all the posted suggestions and
    hints, so I still have to do some homework here...

    Didn't I see you reference something called "ssmtp" ?
    That's a program for sending email. So "man ssmtp" should give you more info. Also try this page...

    https://linuxhandbook.com/linux-send-email-ssmtp/

    If I recalled wrongly, then apologies for the noise.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to John-Paul Stewart on Wed Jan 26 16:22:50 2022
    On 1/26/22 9:28 AM, John-Paul Stewart wrote:
    Be aware that on Ubuntu, "sendmail" may not actually be the original
    sendmail program. Almost all Message Transfer Agents (MTAs) install
    a /usr/bin/sendmail program or symlink.

    The sendmail (executable) has become a defacto command line interface
    for sending email, be it the actual Sendmail (program) or Postfix
    (program) or something else.

    I consider the sendmail (executable) to be (ab)used in the same way as
    an API.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Fenris on Wed Jan 26 16:20:50 2022
    On 1/26/22 9:33 AM, Fenris wrote:
    Maybe running `killall gnome-keyring-daemon' before the command?

    I would avoid doing that.

    Especially if you're using the gnome-keyring-daemon as the ssh agent
    managing keys.

    This suggestion seems akin to a scream test to me.

    Just to approach that "gnome-keyring" is the problem but not sendmail etc.

    I don't think that the Gnome keyring, nor Sendmail (the program) is the
    OPs problem.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to William Unruh on Wed Jan 26 15:29:55 2022
    William Unruh <unruh@invalid.ca> writes:
    [...]
    Figure out what your MTA (Mail transfer agent) is. Is it really sendmail, or is it something
    like postfix?
    Eg on my system (Mageia not Ubuntu):

    tunnel:1.0[unruh]>l /sbin/sendmail
    lrwxrwxrwx 1 root root 34 Apr 12 2019 /sbin/sendmail -> /etc/alternatives/sendmail-command
    l /etc/alternatives/sendmail-command
    lrwxrwxrwx 1 root root 26 Apr 12 2019 /etc/alternatives/sendmail-command -> /usr/sbin/sendmail.postfix

    (l is an alias for ls -la)

    On my Ubuntu 20.04 system:

    $ type sendmail
    sendmail is /usr/sbin/sendmail
    $ ls -l /usr/sbin/sendmail
    -rwxr-xr-x 1 root root 35128 Sep 6 23:58 /usr/sbin/sendmail
    $ dpkg -S /usr/sbin/sendmail
    postfix: /usr/sbin/sendmail


    The point being that just listing the sendmail executable might not tell
    you what it is. ("dpkg -S" tells you what package provides a given
    file. You'll need to use some other command on a system that's not Debian-based.)

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Philips
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Lew Pitcher on Wed Jan 26 16:16:15 2022
    On 1/26/22 7:59 AM, Lew Pitcher wrote:
    Sendmail configuration is indeed complex, mostly due to the archaic
    form of it's configuration file, and the variety of options available
    for mail handling.

    As much as I might not like it, I agree with this statement.

    However, depending on your distro, your installation may have come
    with one or more sample configurations, most of which are relatively
    easy to modify for use.

    I don't think I've used distribution provided templates before. I
    usually use the generic templates that come with the (various) Sendmail (cf|config) package(s).

    I personally run sendmail as my public MTA, with some custom config
    changes to handle miltering (raw email filtering) and secured outbound
    email relaying (through my ISP's MTA). My sendmail.mc file runs 22
    lines (excluding comments), and only differs from my distro's stock sendmail.mc by 4 lines.

    I also run Sendmail, by choice, as my MTA.

    FWIW, I can recommend
    "sendmail"
    by Bryan Costales with Eric Allman
    O'Reilly & Associates
    ISBN 1-56592-222-0
    as a /really/ good book on the subject, and
    "sendmail Cookbook"
    by Craig Hunt
    O'Reilly & Associates
    ISBN 0-596-00471-0
    as a good guide to some common (and uncommon) configuration requirements.

    I'm sure those are wonderful sources of Sendmail information. However
    I'm quite certain that I would definitely *NOT* recommend that someone
    who simply wants to get an MTA function to send email read them. I
    would, and have, recommended both of them to someone who wanted to learn
    more about Sendmail specifically.

    These books fall into the category of telling you how to build a clock
    before telling what time to set it to.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Unruh@21:1/5 to Janis Papanagnou on Thu Jan 27 02:00:17 2022
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
    On 26.01.2022 19:18, William Unruh wrote:

    Figure out what your MTA (Mail transfer agent) is. Is it really sendmail, or is it something
    like postfix?
    Eg on my system (Mageia not Ubuntu):

    tunnel:1.0[unruh]>l /sbin/sendmail
    lrwxrwxrwx 1 root root 34 Apr 12 2019 /sbin/sendmail -> /etc/alternatives/sendmail-command
    l /etc/alternatives/sendmail-command
    lrwxrwxrwx 1 root root 26 Apr 12 2019 /etc/alternatives/sendmail-command -> /usr/sbin/sendmail.postfix

    /usr/sbin/sendmail -> ssmtp

    So it seems that you use ssmtp as your MTA. That is supposed to be a
    simple message transfer agent.
    It appears to have its setup in /etc/ssmtp/ssmtp.conf, which probably
    includes the server. It may be that it only uses the server if the mail
    is not local mail (in fact the server could not handle local mail at all anyway, as it is probably on its own private network hidden from the
    outside world). Thus ssmtp tries to send it to a local machine, and that machine is not running ssl for the mail receiving, and it thus craps
    out. This is all a guess, since I have no idea how ssmtp world or what
    your network topology is or almost anything else about your system.



    The latter is an executable file.


    Does regular mail work? What do you use as your normal mailer-- not
    mailx I presume. What MTA does it use? It is still working?

    Yes, as the standard email application I use a Thunderbird client.
    As outgoing server there's one at my ISP defined, dedicated to my
    account; I haven't configured anything else when I had set it up.

    Thinking about it; how would 'mailx' know that outgoing server?
    It must be defined somewhere, I suppose.

    Janis


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From andrew@21:1/5 to Janis Papanagnou on Thu Jan 27 02:46:28 2022
    On 2022-01-26, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

    * Is there some other (preferred, simpler, or without crypto demands) interface or tool to send emails automatically from a shell script?

    mailx on Slackware is s-nail and the following ~/.mailrc has worked
    flawlessly for me (using gmail):

    https://www.linuxquestions.org/questions/slackware-14/prepping-for-mailx-version-v15-from-14-9-17-a-4175671975/#post6104757

    I see that Ubuntu has an s-nail package but it is not the default
    command line mailer.

    Andrew
    --
    You think that's air you're breathing now?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jorgen Grahn@21:1/5 to William Unruh on Tue Feb 15 07:23:17 2022
    On Wed, 2022-01-26, William Unruh wrote:
    On 2022-01-26, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    On Wed, 26 Jan 2022 15:20:04 +0100, Janis Papanagnou wrote:

    [snip]
    [*] I've heard that sendmail configuration is a nightmare.

    Sendmail configuration is indeed complex, mostly due to the
    archaic form of it's configuration file, and the variety of options
    available for mail handling.

    Many distributions now use postfix as the mail sender/receiver, not
    sendmail. It has a "sendmail" stub to make software think that it is
    sendmail that is being used. Check what you are using first.

    I haven't checked this, but it's also possible that it was the other
    way around: sendmail the utility for local mail delivery being older
    than Sendmail the daemon.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Jorgen Grahn on Tue Feb 15 12:16:26 2022
    On Tue, 15 Feb 2022 07:23:17 +0000, Jorgen Grahn wrote:

    On Wed, 2022-01-26, William Unruh wrote:
    On 2022-01-26, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    On Wed, 26 Jan 2022 15:20:04 +0100, Janis Papanagnou wrote:

    [snip]
    [*] I've heard that sendmail configuration is a nightmare.

    Sendmail configuration is indeed complex, mostly due to the archaic
    form of it's configuration file, and the variety of options available
    for mail handling.

    Many distributions now use postfix as the mail sender/receiver, not
    sendmail. It has a "sendmail" stub to make software think that it is
    sendmail that is being used. Check what you are using first.

    I haven't checked this, but it's also possible that it was the other way around: sendmail the utility for local mail delivery being older than Sendmail the daemon.

    Not really. (sendmail.org) sendmail (the daemon) routes with preformatted
    email messages. You /can/ invoke the binary as a foreground process, and
    that invocation will accept a preformatted email message for routing (and promptly route it via the sendmail daemon).

    From the sendmail(8) manpage:
    Sendmail is not intended as a user interface routine; other programs
    provide user-friendly front ends; sendmail is used only to deliver pre-
    formatted messages.

    With no flags, sendmail reads its standard input up to an end-of-file
    or a line consisting only of a single dot and sends a copy of the mes-
    sage found there to all of the addresses listed. It determines the
    network(s) to use based on the syntax and contents of the addresses.

    So, you see, it is possible to use sendmail as a (very crude) MUA, but,
    like telnetting to port 25 and entering mail by hand, it is not a very
    friendly way to initiate an email message.

    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Grant Taylor on Tue Feb 15 19:50:14 2022
    On Tue, 15 Feb 2022 12:32:58 -0700, Grant Taylor wrote:

    On 2/15/22 12:23 AM, Jorgen Grahn wrote:
    I haven't checked this, but it's also possible that it was the other
    way around: sendmail the utility for local mail delivery being older
    than Sendmail the daemon.

    Um....

    I guess that's not outside of the realm of possibility. Though I think
    it's unlikely for a couple of reasons. Sendmail is quite old, going
    back to when there weren't very many choices. More importantly, why
    would a utility that predates "Sendmail" have it's name?

    My understanding is that Sendmail, the MTA that we either love or loath,
    goes back to (at least) the early '90s, if not the '80s, and was a
    re-write / port of send-mail, it's predecessor, on some platform that
    might not have been Unix.

    What am I misremembering?

    From
    https://www.oreilly.com/library/view/sendmail-3rd-edition/1565928393/ pr03s03.html

    "The sendmail program was originally written by Eric Allman while he
    was a student and staff member at the University of California at
    Berkeley.
    ...
    A sudden increase in protocol types, coupled with the anticipation of
    an explosion in the number of networks, motivated Eric Allman to write
    delivermail — the precursor to sendmail. The delivermail program was
    shipped in 1979 with 4.0 and 4.1 BSD Unix.
    ...
    In 1980, ARPAnet began converting from Network Control Protocol (NCP)
    to Transmission Control Protocol (TCP). ... Responding to these and
    other changes, Eric evolved delivermail into sendmail ...
    ...
    The first sendmail program was shipped with 4.1c BSD (the first
    version of Berkeley Unix to include TCP/IP). From that first release
    to the present,[2] Eric has continued to enhance sendmail, first at UC
    Berkeley, then at Britton Lee, then back at UC Berkeley, then with
    InReference Inc., and now with Sendmail, Inc. The current major
    version of sendmail is V8, a major rewrite that includes many bug
    fixes and significant enhancements.
    ...
    In 1992, Eric started creating a new version of sendmail to merge all
    the earlier versions. V8 officially adopted most of the good features
    from IDA, KJS, Sun, and HP’s sendmail, and kept abreast of the latest
    standards from the Internet Engineering Task Force (IETF). In 1996,
    Eric began work on V8.8 sendmail. This release continued the trend
    begun with V8.7, adding many requested new features and options, and
    tightening security. In 1998, V8.9 was released, continuing the
    direction started by V8.8.
    ...
    In 1999, Sendmail, Inc. was founded in Emeryville, California.
    Sendmail, Inc. took over maintenance and development of the open source
    version of sendmail, and began work on a commercial version.
    ...
    "
    and so on

    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Jorgen Grahn on Tue Feb 15 12:32:58 2022
    On 2/15/22 12:23 AM, Jorgen Grahn wrote:
    I haven't checked this, but it's also possible that it was the other
    way around: sendmail the utility for local mail delivery being older
    than Sendmail the daemon.

    Um....

    I guess that's not outside of the realm of possibility. Though I think
    it's unlikely for a couple of reasons. Sendmail is quite old, going
    back to when there weren't very many choices. More importantly, why
    would a utility that predates "Sendmail" have it's name?

    My understanding is that Sendmail, the MTA that we either love or loath,
    goes back to (at least) the early '90s, if not the '80s, and was a
    re-write / port of send-mail, it's predecessor, on some platform that
    might not have been Unix.

    What am I misremembering?



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Lew Pitcher on Tue Feb 15 18:22:28 2022
    On 2/15/22 12:50 PM, Lew Pitcher wrote:
    From
    https://www.oreilly.com/library/view/sendmail-3rd-edition/1565928393/ pr03s03.html
    ...
    and so on

    Most of that matches what I remember. Though I did have the precursor
    name wrong. It was "delivermail".



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to Grant Taylor on Tue Feb 15 20:57:56 2022
    On Tue, 15 Feb 2022 20:22:28 -0500, Grant Taylor <gtaylor@tnetconsulting.net> wrote:

    On 2/15/22 12:50 PM, Lew Pitcher wrote:
    From
    https://www.oreilly.com/library/view/sendmail-3rd-edition/1565928393/
    pr03s03.html
    ...
    and so on

    Most of that matches what I remember. Though I did have the precursor
    name wrong. It was "delivermail".

    According to wikipedia, unix had the command mail when it started in 71. https://en.wikipedia.org/wiki/Mail_(Unix)

    Regards, Dave Hodgins

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to David W. Hodgins on Tue Feb 15 23:06:23 2022
    On 2/15/22 6:57 PM, David W. Hodgins wrote:
    According to wikipedia, unix had the command mail when it started in 71. https://en.wikipedia.org/wiki/Mail_(Unix)

    My understanding of the mail command is that it qualifies as a Mail User
    Agent (MUA), meant for composing outgoing email and reading incoming
    email. On the other hand, a Mail Transport Agent (MTA), like
    delivermail and sendmail, is meant for taking email, nominally from
    MUAs, and routing it to where it needs to go, be it local delivery via a
    Local Delivery Agent (LDA), or a remote MTA via some communications
    protocol.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to Grant Taylor on Wed Feb 16 13:11:34 2022
    On Wed, 16 Feb 2022 01:06:23 -0500, Grant Taylor <gtaylor@tnetconsulting.net> wrote:

    On 2/15/22 6:57 PM, David W. Hodgins wrote:
    According to wikipedia, unix had the command mail when it started in 71.
    https://en.wikipedia.org/wiki/Mail_(Unix)

    My understanding of the mail command is that it qualifies as a Mail User Agent (MUA), meant for composing outgoing email and reading incoming
    email. On the other hand, a Mail Transport Agent (MTA), like
    delivermail and sendmail, is meant for taking email, nominally from
    MUAs, and routing it to where it needs to go, be it local delivery via a Local Delivery Agent (LDA), or a remote MTA via some communications
    protocol.

    Looks like in the original version, it only worked for sending mail between users on the same system, so no transport involved.

    Regards, Dave Hodgins

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to David W. Hodgins on Wed Feb 16 13:19:35 2022
    On 2/16/22 11:11 AM, David W. Hodgins wrote:
    Looks like in the original version, it only worked for sending mail
    between users on the same system, so no transport involved.

    Interesting.

    Thank you for correcting and clarifying. #TIL



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)