I have two issues with my script one of which i would like to discuss here.
Its my compulsion to use sendmail
.
My sample script
#!/bin/bash
{
print 'From: Prod@`hostname`.mycomp.com'
print 'To: me@mycomp.com'
print 'MIME-Version: 1.0'
print 'Content-Type: text/html'
print 'Subject: Usage Report'
print ''
print '<html>'
print '<body>'
print '<p>Today Usage Report for Server</p>'
print '</body>'
print '</html>'
} | /usr/sbin/sendmail -t
Wehn i run the above with debug mode i see that the hostname is not substituted in the From of the email.
i also tried the below in vain
print 'From: Prod@$hostname.mycomp.com'
uname -a
SunOS myhost 5.11 11.3 sun4u sparc SUNW,SPARC-Enterprise
Can you please suggest something that works with both bash and ksh shells ?