Discussion:
about heirloom mailx
(too old to reply)
Harry Putnam
2014-05-28 02:20:01 UTC
Permalink
Running jessie

Trying to use heirloom mailx to test various exim4 settings and It
works, but there is something in it that bugs me. Makes me think I'm
doing something wrong.

Here is a typical example

mailx -v ***@location.com
Subject: what ever
ble
bleh
.
<ENTER>

And away it goes and outputs the smtp conversation ending in the
message

[...]

LOG: MAIN
Completed

But then I never get the prompt back.

The cmdline is live... that is, if I type a cmd it will be executed
and then I get the prompt back.

Or I can hit Enter, or ^c to get the prompt back.

But shouldn't I get the prompt back when the process
completes.. without having to do anything extra?

Or am I just not using it correctly from the gate?
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@reader.local.lan
Richard Hector
2014-05-28 02:40:02 UTC
Permalink
Post by Harry Putnam
Running jessie
Trying to use heirloom mailx to test various exim4 settings and It
works, but there is something in it that bugs me. Makes me think I'm
doing something wrong.
Here is a typical example
Subject: what ever
ble
bleh
.
<ENTER>
And away it goes and outputs the smtp conversation ending in the
message
[...]
LOG: MAIN
Completed
But then I never get the prompt back.
The cmdline is live... that is, if I type a cmd it will be executed
and then I get the prompt back.
Or I can hit Enter, or ^c to get the prompt back.
But shouldn't I get the prompt back when the process
completes.. without having to do anything extra?
Or am I just not using it correctly from the gate?
I'm not currently using heirloom mailx, or exim, so testing it is a bit
hard - but are you getting the prompt _before_ the debug output?

I suspect it might put itself into the background, which will give you
the prompt, then the background process spits out the SMTP session.

Richard
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@walnut.gen.nz
Chris Davies
2014-05-28 11:30:02 UTC
Permalink
Post by Richard Hector
I'm not currently using heirloom mailx, or exim, so testing it is a bit
hard - but are you getting the prompt _before_ the debug output?
This is how I've seen the mail / mailx tools work since, I think, at
least the last twenty years. (Ouch!) So I would suggest it's really
quite likely this is the situation here.

Chris
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@news.roaima.co.uk
Curt
2014-05-28 10:00:03 UTC
Permalink
Post by Harry Putnam
But shouldn't I get the prompt back when the process
completes.. without having to do anything extra?
Or am I just not using it correctly from the gate?
Well the man page says:

Ending a mail processing session
You can end a mail session with the quit (q) command.

So I think what you're seeing is "normal" (horrible word that).
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@einstein.electron.org
Bob Proulx
2014-05-29 00:50:01 UTC
Permalink
Post by Harry Putnam
Trying to use heirloom mailx to test various exim4 settings and It
works, but there is something in it that bugs me. Makes me think I'm
doing something wrong.
I use mailx for sending emails all of the time. I don't see the
problem you reported. Works for me.

Normally I use the mailx from bsd-mailx. I just now tested with
heirloom-mailx and it behaves the same. That is to say it works
fine. Because of the alternatives can you verify that you are using
the version of mailx that you expect?

On my system after installing heirloom-mailx I now have:

# update-alternatives --display mailx
mailx - auto mode
link currently points to /usr/bin/heirloom-mailx
/usr/bin/bsd-mailx - priority 50
slave Mail: /usr/bin/bsd-mailx
slave Mail.1.gz: /usr/share/man/man1/bsd-mailx.1.gz
slave mail: /usr/bin/bsd-mailx
slave mail.1.gz: /usr/share/man/man1/bsd-mailx.1.gz
slave mailx.1.gz: /usr/share/man/man1/bsd-mailx.1.gz
/usr/bin/heirloom-mailx - priority 60
slave Mail: /usr/bin/heirloom-mailx
slave Mail.1.gz: /usr/share/man/man1/heirloom-mailx.1.gz
slave mail: /usr/bin/heirloom-mailx
slave mail.1.gz: /usr/share/man/man1/heirloom-mailx.1.gz
slave mailx.1.gz: /usr/share/man/man1/heirloom-mailx.1.gz
/usr/bin/mh/mhmail - priority 25
slave Mail: /usr/bin/mh/mhmail
slave Mail.1.gz: /usr/share/man/man1/mhmail.1.gz
slave mail: /usr/bin/mh/mhmail
slave mail.1.gz: /usr/share/man/man1/mhmail.1.gz
slave mailx.1.gz: /usr/share/man/man1/mhmail.1.gz
Current 'best' version is '/usr/bin/heirloom-mailx'.
Post by Harry Putnam
Here is a typical example
Subject: what ever
ble
bleh
.
<ENTER>
And away it goes and outputs the smtp conversation ending in the
message
[...]
LOG: MAIN
Completed
But then I never get the prompt back.
This is what I see:

***@havoc:~$ echo test test test | mailx -s "heirloom-mailx test" ***@proulx.com
***@havoc:~$

And the same with bsd-mailx too.
Post by Harry Putnam
The cmdline is live... that is, if I type a cmd it will be executed
and then I get the prompt back.
Please verify that you have a clean .mailrc file. It is possible that
commands in that file will be a source of breakage. Normally aliases
live there.
Post by Harry Putnam
Or I can hit Enter, or ^c to get the prompt back.
But shouldn't I get the prompt back when the process
completes.. without having to do anything extra?
Yes. That is how it works for me.
Post by Harry Putnam
Or am I just not using it correctly from the gate?
See my example for how it works for me.

Bob
Richard Hector
2014-05-29 04:50:04 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Bob Proulx
Post by Harry Putnam
Trying to use heirloom mailx to test various exim4 settings and
It works, but there is something in it that bugs me. Makes me
think I'm doing something wrong.
I use mailx for sending emails all of the time. I don't see the
problem you reported. Works for me.
Normally I use the mailx from bsd-mailx. I just now tested with
heirloom-mailx and it behaves the same. That is to say it works
fine. Because of the alternatives can you verify that you are
using the version of mailx that you expect?
# update-alternatives --display mailx mailx - auto mode link
currently points to /usr/bin/heirloom-mailx /usr/bin/bsd-mailx -
/usr/share/man/man1/bsd-mailx.1.gz slave mail: /usr/bin/bsd-mailx
slave mail.1.gz: /usr/share/man/man1/bsd-mailx.1.gz slave
mailx.1.gz: /usr/share/man/man1/bsd-mailx.1.gz
/usr/share/man/man1/heirloom-mailx.1.gz /usr/bin/mh/mhmail -
/usr/share/man/man1/mhmail.1.gz slave mail: /usr/bin/mh/mhmail
/usr/share/man/man1/mhmail.1.gz Current 'best' version is
'/usr/bin/heirloom-mailx'.
Post by Harry Putnam
Here is a typical example
<ENTER>
And away it goes and outputs the smtp conversation ending in the
message
[...]
LOG: MAIN Completed
But then I never get the prompt back.
You're not using the -v option, which tells the MTA to be verbose.
Exim then spits out the SMTP session, while postfix captures it and
send you back an email.

Now that I put it like that, I understand it better myself - mailx
isn't putting itself in the background, but the MTA continues to work
asynchronously.

Richard

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQEcBAEBAgAGBQJThrvrAAoJELSi8I/scBaNp14H/jLloqvY0gnkyIYNesTWCGMv
zf1mJRSQ58fpHZvGVSfYH1PWVvXjDMsCbYYJV9hqd+bPJws9r0YnyEk8Q7HvX66m
rDXk1Bh9vxj7IFV6GEmb44Lr1tKgL6AGesA8+1Q/H7NcWVMQa/AbTh5qS4BRTv3r
gADHJ2XEoXFrnxGZahBX1uIPJ+tgE7/IpM8uJyqy3dzJl6/XMMe33VB0sz0V3a/s
SXlWknGH1JnEJg5XSifl3bNcfXNQmognMY2t9Y3YmIsFNfLu/5AzXbBxWmCd0hrh
ngvLgSxp0csZa/BaWwi2+4EUsiaU0kba+SNiOriHTKlGejAw+wWmn8GbZbT+C7c=
=F6aG
-----END PGP SIGNATURE-----
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@walnut.gen.nz
Bob Proulx
2014-05-29 20:50:02 UTC
Permalink
Post by Richard Hector
You're not using the -v option, which tells the MTA to be verbose.
Exim then spits out the SMTP session, while postfix captures it and
send you back an email.
Now that I put it like that, I understand it better myself - mailx
isn't putting itself in the background, but the MTA continues to work
asynchronously.
I didn't use the -v option because I didn't want a delivery status
report that heirloom-mailx seems to request as well. But just for the
test I will do it and then delete the report.

***@havoc:~$ mailx -v ***@proulx.com
Subject: test
test
.
EOT
Mail Delivery Status Report will be mailed to <rwp>.
***@havoc:~$

It is that "Mail Delivery Status Report will be mailed to <rwp>." that
I was avoiding. I get the test message to myself. And I get a
delivery status notification that the message was delivered. I didn't
want that last. Note that I am using Postfix. I don't know if Exim
implements the -v option the same way.

$ man sendmail (postfix's sendmail)
...
-v Send an email report of the first delivery attempt (Postfix
versions 2.1 and later). Mail delivery always happens in the
background. When multiple -v options are given, enable verbose
logging for debugging purposes.

If I am testing out mail and wanting to observe the SMTP handshake
then I recommend "swaks" (Swiss Army Knife SMTP, the all-purpose smtp
transaction tester). It is a useful tool.

swaks --to $(whoami)@$(hostname -f) --server localhost
=== Trying localhost:25...
=== Connected to localhost.
<- 220 havoc.proulx.com ESMTP Postfix (Debian/GNU)
-> EHLO havoc.proulx.com
<- 250-havoc.proulx.com
<- 250-PIPELINING
<- 250-SIZE 102400000
<- 250-VRFY
<- 250-ETRN
<- 250-STARTTLS
<- 250-ENHANCEDSTATUSCODES
<- 250-8BITMIME
<- 250 DSN
-> MAIL FROM:<***@havoc.proulx.com>
<- 250 2.1.0 Ok
-> RCPT TO:<***@proulx.com>
<- 250 2.1.5 Ok
-> DATA
<- 354 End data with <CR><LF>.<CR><LF>
-> Date: Thu, 29 May 2014 14:41:06 -0600
-> To: ***@proulx.com
-> From: ***@havoc.proulx.com
-> Subject: test Thu, 29 May 2014 14:41:06 -0600
-> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/
->
-> This is a test mailing
->
-> .
<- 250 2.0.0 Ok: queued as E6DAF2DC05
-> QUIT
<- 221 2.0.0 Bye
=== Connection closed with remote host.

And there are many other options for customizing exactly what type of
testing you are wanting to do. This tool is for SMTP testing and
doesn't use /usr/sbin/sendmail however.
Post by Richard Hector
Now that I put it like that, I understand it better myself - mailx
isn't putting itself in the background, but the MTA continues to work
asynchronously.
The mailx command is sending the message through /usr/sbin/sendmail
(which you might remember as /usr/lib/sendmail in the old days) and
then sendmail is sending the mail. The name "/usr/sbin/sendmail" in
this case will be an alternative and be either Postfix or Exim or
Sendmail or Nullmailer or other MTA as installed and configured by the
alternatives. All of the MTA alternatives in Debian should work fine
as an alternative /usr/sbin/sendmail interface.

By default /usr/sbin/sendmail will drop the message into the queue and
then notify the running daemon that a new message is available for
transmission and will return to the caller very quickly. Delivery
will occur in the background through the MTA daemon. So mailx itself
is never in the background. But email is designed to be a store and
forward background delivery and it occurs in the background on a best
effort basis. I say best effort because if the disk is full or if the
cpu load is too high or the network offline then delivery will be
delayed until resources are available for it to be completed or until
it times out.

As to why your command prompt isn't being emitted after the task is
done that seems very strange to me. Definitely not normal. As you
can see from my examples it works fine for me. Please let us know
what you find is the problem.

Bob
Richard Hector
2014-05-30 05:00:02 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Bob Proulx
As to why your command prompt isn't being emitted after the task
is done that seems very strange to me. Definitely not normal. As
you can see from my examples it works fine for me. Please let us
know what you find is the problem.
I've just installed exim and heirloom-mailx on a test vm to confirm my
suspicions.

mailx does give the prompt back - but because a delivery report was
requested, and exim sends it to the screen rather than emailing it,
the prompt disappears in the noise (my exim config isn't correct, so
the mail goes nowhere, but that doesn't matter for the example). The
prompt comes back after the first 2 lines of the delivery report:

- -------8<---------
***@test:~$ mailx -v ***@walnut.gen.nz
Subject: test
asdf
EOT
LOG: MAIN
<= ***@test.lan.walnut.gen.nz U=richard P=local S=529
***@test:~$ delivering 1WqEdr-0008Bx-7C
R: nonlocal for ***@walnut.gen.nz
LOG: MAIN
** ***@walnut.gen.nz R=nonlocal: Mailing to remote domains not
supported
LOG: MAIN
<= <> R=1WqEdr-0008Bx-7C U=Debian-exim P=local S=1419
delivering 1WqEdr-0008C1-BH
R: system_aliases for ***@test.lan.walnut.gen.nz
R: userforward for ***@test.lan.walnut.gen.nz
R: procmail for ***@test.lan.walnut.gen.nz
R: maildrop for ***@test.lan.walnut.gen.nz
R: lowuid_aliases for ***@test.lan.walnut.gen.nz (UID 1000)
R: local_user for ***@test.lan.walnut.gen.nz
T: appendfile for ***@test.lan.walnut.gen.nz
LOG: MAIN
Completed
LOG: MAIN
=> richard <***@test.lan.walnut.gen.nz> R=local_user T=mail_spool
LOG: MAIN
Completed
- -------8<--------

Richard

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQEcBAEBAgAGBQJTiA3cAAoJELSi8I/scBaNwAYH/RI8e+0RKwkT+ULx7MgO06d/
X11UyJhk7obyKItrSuHGuGqXIKlGVG0urSdXXyW2kW6O5ccj4OUQIB5dTI76dJD3
6H5fukzD5l6TJ0ua+7Mz2IrJl5EUEas4HyUtw681BzQGVfCaCFnqrAARi8R29HqN
cr/KjRpkyxY0uyvBxHEkRCnGRu7D/cqD/fYMKi8Sl81i8JwxiQBY3MyCxlcWyEti
YJu/ozUacjSFYoCjc9H+3+TKUuelcHTGzQOIOGtHg2+jj44ElGHkn47BhaWsh9YG
//teSISH6jOd9m/pEVO790M28/YeKBeVWgtkXMRnJwPvgucxCMJHoFbf3rODqac=
=KEvp
-----END PGP SIGNATURE-----
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@walnut.gen.nz
Brian
2014-05-30 14:30:01 UTC
Permalink
Post by Richard Hector
Post by Bob Proulx
As to why your command prompt isn't being emitted after the task
is done that seems very strange to me. Definitely not normal. As
you can see from my examples it works fine for me. Please let us
know what you find is the problem.
I've just installed exim and heirloom-mailx on a test vm to confirm my
suspicions.
mailx does give the prompt back - but because a delivery report was
requested, and exim sends it to the screen rather than emailing it,
the prompt disappears in the noise (my exim config isn't correct, so
the mail goes nowhere, but that doesn't matter for the example). The
Nothing strange here. mailx completes and, as you say, the prompt is
returned. The "noise" is from exim's standard error stream. It is
instructive to do

mailx -v ***@walnut.gen.nz 2> eximlog

or

mailx -v ***@walnut.gen.nz 2>&1 | tee

A similar thing can happen with the standard error stream when a USB
stick is attached or a PCMIA wireless card removed from a running
machine.
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@copernicus.demon.co.uk
Loading...