This message has two parts. The first is about the basic
mail program. The second (which
is more important to me) is about how to avoid having to use
the mail program.
Part I: The Basic mail program
(I'm running CentOS.)
I asked last night about the basic mail program -
specifically about navigating through the
headers. Chuck looked up some documentation and said that
the "h+" and "h-" commands
should do it. And, somebody came up to me with his laptop
and showed the "z" command.)
Here's what the help file within mail shows about the "z"
command:
(Yes. -It says nothing about the z command.)
Here's what I found with the h+ and h- commands:
When I invoke mail, it displays the headers of 38 unread messages
(numbers 1 - 38)
and a prompt ("&"). (The terminal window is
132 characters wide by 42 lines long.)
If I type h+, it displays the same 38 headers again. (h-
gets "Referencing before 1")
If I type h7865782365, I get "Invalid message
number". If I type h 1-a, I get "Non-numeric
second argument". If I type h 1-4, I get the first 38
headers. The program seems to
be parsing what follows an "h", but royally screws
up acting on what it finds.
If I type "39", I get message 39. (There doesn't
seem to be a "LAST" command to
see the last message - and find out its number. So, typing,
say, 100, gets an error
because there's no such message.) Anyway, after viewing message
39, if I THEN type h,
it shows headers for messages 39 - 51. (h+ shows the same
headers, 39 - 51.)
But, h- now shows the first 38. (That makes sense.) But,
after using h- to get back
to the 1 - 38 list, h+ shows the first 38 messages again.
After displaying the first 38 headers, the "z"
command DOES cause the next set of headers
to be displayed (39 - 51).
I figured that, until I figure out how to set things up to
forward the logwatch mail to a
gmail account, I could tolerate using a separate, basic mail
program to check the logs.
But, this is crap. People were asking about the guy who
screwed up the OpenSSL
heartbeat code. What about the guy who wrote this piece of
crap? It's very basic stuff
that doesn't work. Not too difficult to test...
Part II: Getting EMail Forwarded from the Linux System as a
Client
I have two interests here. One is just academic.
-Understanding how to use the mail program,
despite (or because of) its suckiness.
The other is so I can see the messages that the log scrapers
send via /bin/mail to the root
account's email. Ideally, I would set things up to have all
of root's email get forwarded to,
say, a gmail account.
But, my setup seems to place some limits on what I can do.
I set up an MTA on my VMS box long ago. I used to be able
to send email directly from
that system. But, it stopped working at some point, and I
found that Verizon reports all of the
DHCP addresses that they allocate to residential DSL
customers as spam sources, so
everything was getting blocked.
I have written programs (in PHP) that use a PEAR class/API
to send email from the
Linux box, via a gmail account, to arbitrary addressees.
[It requires such information
as host (smtp.gmail.com), port (587), username &
password for the gmail account...]
So, I'm not sure if an MTA is what I really need. Can at
MTA be set up to send email as
a client of sorts to a real MTA (e.g., google mail)? Or do
I need some other type of
utility?
Sure, I can write my own, but I would hope that somebody
else has already done it.
(Well, as long as it's not the person who wrote
"mail".)