[Linux-Discussion] Re: Mail Script

  • From: John Madden <weez@xxxxxxxxxxxxx>
  • To: linux-discussion@xxxxxxxxxxxxx
  • Date: Sat, 31 Aug 2002 19:09:56 -0500

> Does anyone know of an easy way (or some documentation) on how to use
> mail/sendmail in a shell script? I'd think this would be well
> documented, but my Google search tonight is yielding nothing. I would
> just like to add a simple line to the rc.local on a box that would send
> me a message anytime the system reboots.

From a perl script, I'd open a pipe to it: open (MAIL, "|sendmail");, but I 
don't know how to do that from a shell script (or if it can be done?).  So 
I'd create a file containing the email you want sent, and then go "cat 
thatfile | sendmail yourusername"

John




Other related posts: