Operating System - HP-UX
1834370 Members
2218 Online
110066 Solutions
New Discussion

mailing from hpux or linux

 
sanwin
Frequent Advisor

mailing from hpux or linux

Hi,
Bascially how to send mails from hpux or linux servers?
I need to execute certain scripts and sent their results as mails.
could anyone help?


thanks and regards,
sanwin
6 REPLIES 6
Oviwan
Honored Contributor

Re: mailing from hpux or linux

Hey

man mailx
or
man sendmail

Regards
James R. Ferguson
Acclaimed Contributor

Re: mailing from hpux or linux

Hi Sanwin:

# mailx -s "This is a subject!" sanwin < /dev/null

...would mail the 'sanwin' user with a subject line "This is a subject" and an empty mail body.

Regards!

...JRF...
spex
Honored Contributor

Re: mailing from hpux or linux

Hi Sanwin,

Under HP-UX, first set the "smart" relay host macro in /etc/sendmail.cf to point to your mail gateway ('DSyourgateway.yourdomain.com').

Then restart the sendmail daemon to force it to re-read /etc/sendmail.cf:
$ /sbin/sendmail stop && /sbin/sendmail start

Then send a test message:
$ echo 'body' | mailx -m -s 'subject' your@email.addr

Linux is similar.

PCS
Dave La Mar
Honored Contributor

Re: mailing from hpux or linux

Sanwin -
Attached is an inhouse doc we use foe diferrent types of mail requests.

Regards,

-dl
"I'm not dumb. I just have a command of thoroughly useless information."
Abhinesh AV
Occasional Advisor

Re: mailing from hpux or linux

Hi,

Here is a small example script....

This will send you disk usage of a group of servers o/p to your email ID .

=====================================
#Server Disk usage report
output=/tmp/diskbdf
echo "" >$output
for i in `cat serverlist` # serverlist will contail hostnames of servers
do
echo " ">>$output
echo "*************************************************************">>$output
echo "Disk Usage Report OF SERVER "$i" on `date`">>$output
echo "Disk Usage REPORT OF SERVER "$i" on `date`"
echo "*************************************************************">>$output
ssh -q $i bdf >>$output
echo " ">>$output
echo " ">>$output
echo "**************END OF REPORT "$i"**************">>$output
echo " ">>$output
echo " ">>$output
echo "==================================================================">>$output
done
mailx -s "Disk Usage Report of China Unix servers" you@yourdomain.com< $output
Steven E. Protter
Exalted Contributor

Re: mailing from hpux or linux

Shalom,

Mail depends on two basic areas of functionality.

1) Host name resolution. If you can resolve Internet hostnames yourself and port 25 is open on your firewall, your system will send mail on its default configuration. For sendmail with attachments, see this script http://www.hpux.ws/mailfile2
2) A mail relay server. DShostnameofrelayserver in sendmail.cf. The accepting server must be configured to accept mail, it will not do so by default.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com