I tried to Sends email but somehow email not getting out, please help me how I can write shell script in right manner. Thanks and regards

This is the one I tried my end.

set wma = `grep -i "java" sampletest`
echo $wma
mail -v -s "ALERT" tamilmercy@yahoo.com < alertfile

r.invoke.InvokeManager.process(InvokeManager.java:612) :i
tamilmercy@yahoo.com... Connecting to [] via relay...
tamilmercy@yahoo.com... Deferred: Connection refused by []

Hey There,

The last line of your script is actually okay. The error you're getting looks like it's coming from sendmail. Depending on what version you're running you may need to edit /etc/mail/sendmail.cf or /etc/mail/submit.cf and specify the IP of the host in DaemonPortOptions - It's either that or ClientPortOptions.

In any event, your script is okay. Looks like sendmail won't send mail no matter what you do right now.

If you invoke
/usr/lib/sendmail -v tamilmercy@yahoo.com

and can post that output, I might be able to tell you what you need to do to make your mail work

Also - you can run
/usr/lib/sendmail -vb tamilmercy@yahoo.com
if you want to get the verbose output but not actually send the mail.

Thanks :)

, Mike

Thanks for your kind reply. I like to write script as follow:

The script to be checked

- “error” message in current server log file
- If found error message than send alert email to system admin email address

I need to be checked on current date -<serverYYMMDD.log> file under log directory if anything “error” message appeared.

please help me out how I can write this type of script. Thanks

This article has been dead for over six months. Start a new discussion instead.