How to change sender’s email id in EMS HPUX

Requirement :

Normally in Event monitoring system ( EMS ) on HPUX send an emails with sender id as root@hostname. Many organizations email servers dont allow such email address in sender field. We need generic email id in sender field when EMS shoots an alert email something like

Workaround :

There is no provision to change this email id anywhere in HPUX or EMS configurations. You can use below workaround which works perfectly without any issues.

Step 1 :
Make sure you have valid email address (like for your logged in account which works. Send a test email from server to verify using below command

Step 2 :
Setup crontab for above logged in account (for which email tested) which will execute EMS log scanner script every 30 minutes. As per your convenience you can even schedule it to run every 10 mins or even lower.

Step 3:
Script code is as below.

Step 4:

Now you can test the script by generating test events in EMS. Generate test event with send_test_event command.

You will receive test events from admin@hostname email id which is normal. Now run above script and you will receive same email with sender id as !!

I have tested this script and it works flawlessly. Please leave comments below if its helpful to you too.

Any thoughts?