Re: Adding "mail" function?

Chuck Yerkes <[email protected]> Wed, 3 Jul 2002 13:54:02 -0700
Newsgroups gmane.os.openbsd.embedded
Message-ID <[email protected]>
Quoting Peter Bako ([email protected]):
> I've just installed the emBSD 1.1 onto my 4501 unit and in general I love
> it!  About the only function I am missing is the "mail" command which I'd
> like to use for sending copies of various logs to an email address before
> flusing them.  Since I'm still a bit new to this *BSD world, can anyone
> offer me tips on how to get the mail command (and all of its associated
> files) moved over?


"mail" requires an MTA.  I'm not going to touch the religious
(meaning based on beliefs and rooted in superstition) issues of
MTA, but using an MTA means getting the file, WRITING the data
to a spool file and opening up an SMTP connection.

Note that word: writing

That means that your 4501 must have a r/w partition somewhere.
That works.  CF is not known to be reliable (this may be a religious
belief).

Options?  Well, you could just whip up a little C program to
emit SMTP commands and do the SMTP handshake
[get SMTP greeting, emit]:
HELO `hostname`
[wait for last "^250 " line, emit]:
Mail From: <Someuser@`hostname`>
[wait for last "^250 " line, emit]:
RCPT TO: <otheruser@$targetHostName>
[wait for last "^250 " line, emit]:
DATA
[wait for last acceptance line (3xx?), emit]:
  some mail headers
a blank line
your message, with "^.$" patterns escaped.
.

and then make sure it got accepted.