Quote:
How would I change the syntax of my script by adding a "From", to tell it from a legitimate e-mail account?? Example: From: real.user@yahoo.comTo: xmdms@yahoo.com Subject: Disk Space is low Your disk space on ______ please check!! |
Quote:
|
Quote:
Example: RECIPENTS="xmdms@yahoo.com" typeset -i error="92" if [ -e \tmp\space.out ]; then rm \tmp\space.out fi for disk in `mount | egrep '^/dev' | egrep -iv 'cdrom|proc|sys|pts' |awk '{print $3}'` do typeset -i diskUsage=`df -h $disk|cut -c40-42|grep -i [^a-z]` if [ "$diskUsage" -ge "$error" ]; then echo "Disk usage $disk exceeded the threshold of $diskUsage%" >> \tmp\space.txt fi done if [ -e \tmp\space.out ]; then message=`cat \tmp\space.out` fi if [ ${#message} -gt 0 ]; then cat \tmp\space.out | mail -s "Disk Usage Report for: $HOSTNAME" $RECIPENTS fi |
mail -r you@domain.com -s "Disk Usage Report for: $HOSTNAME" $RECIPENTS
|
Quote:
Please advice. Thanks!! mail: invalid option -- r Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ... [- sendmail-options ...] mail [-iInNv] -f [name] mail [-iInNv] [-u user] |
Hmm, mine works, but my 'mail' command is a symbolic link to the 'mailx' program. Do you have a 'mailx' program on your computer?
|
Quote:
I wonder..... |
Im on opensuse 11.0, but in my man pages, it says that if you set the 'from' or 'FROM' variable, it should use that as the "from" address of mail addresses, so try this:
Code:
export from="myemail@blah.com" |
Quote:
OPTIONS The mailx utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines. The following options shall be supported. (Only the -s subject option shall be required on all systems. The other options are required only on systems supporting the User Portability Utilities option.) -e Test for the presence of mail in the system mailbox. The mailx utility shall write nothing and exit with a successful return code if there is mail to read. -f Read messages from the file named by the file operand instead of the system mailbox. (See also folder.) If no file operand is specified, read messages from mbox instead of the system mail- box. -F Record the message in a file named after the first recipient. The name is the login-name portion of the address found first on the To: line in the mail header. Overrides the record vari- -H Write a header summary only. -i Ignore interrupts. (See also ignore.) -n Do not initialize from the system default start-up file. See the EXTENDED DESCRIPTION section. -N Do not write an initial header summary. -s subject Set the Subject header field to subject. All characters in the subject string shall appear in the delivered message. The results are unspecified if subject is longer than {LINE_MAX} - 10 bytes or contains a <newline>. able, if set (see Internal Variables in mailx .) -u user Read the system mailbox of the login name user. This shall only be successful if the invoking user has the appropriate privi- leges to read the system mailbox of that user. I guess, I will just have to setup the relay to our Windows Mail Server. |
All times are GMT -5. The time now is 07:32 AM. |