Re: mailing output

From: Bill Thompson (bill.thompson@GOODYEAR.COM)
Date: Fri Aug 01 2003 - 10:39:12 EDT


Shawn,

IMHO the best way to handle any type of mailing is to use sendmail
directly. After all, mail just offloads everything to sendmail anyway.

To do this in sendmail is really pretty simple...

- - - - - snip - - - - -
sendmail -t <<EOF
To: root
Subject: Your Subject Goes Here (quotes are *NOT* necessary)

Here's the output of ls -la:
$(ls -la)

Here's the contents of /etc/hosts:
$(cat /etc/hosts)

EOF
- - - - - snip - - - - -

As you can see, this is far more flexible than mail or mailx

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: "Shawn Bierman" <BiermanS@METHODISTHEALTH.ORG>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Thursday, July 31, 2003 10:44 AM
Subject: mailing output

> Greetings,
>
> I am having a bit of trouble with a script that should email root the
output of a command but also have a subject line.
>
> Currently we just run the command from cron and it gets sent to root's
email but with a subject line. So, I thought i would make a script that
added the subject.
>
> I was hoping for something as easy as:
>
> mail -s"subject line" root | ls -la
>
> even when I output the command to a file and then try to redirect I get
failures.
>
> mail -s"subject line" root < somefile
>
> mail complains of unknow users 'subject' and 'line'.
>
> Is there a simple way?



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:06 EDT