Solved

Help with IBM AIX "mail -s" command not sending a "Subject"?

Posted on 2008-10-06
15
2,630 Views
Last Modified: 2013-11-17
HI there, we are currently running a script that checks certain areas of our system.  

If a problem is found, an E-mail is sent with an EMPTY body notifying us of the problem using the following command.  "mail -s "Firewall is down. $v_datetime"  <Email>   < /dev/null".

This command USED to work fine.  Now all we get is a message with no subject. Any reason why the Subject field would now be empty?

 Any help would be greatly appreciated.
0
Comment
Question by:cdomanski
  • 6
  • 4
  • 2
  • +2
15 Comments
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
I am not sure if mail supports -s option, but if  you have mailx then use

mailx -s "Firewall is down. $v_datetime"  <Email>   < /dev/null

if this is part of a crontab script, then put the full pathname to the command, e.g. /usr/bin/mailx
0
 

Author Comment

by:cdomanski
Comment Utility
Thanks, I just tried your example but I still get no Subject!  

This USED to work.  I can't understand?

If you try exact same command, do you get the correct subject with null body?

Thanks!
0
 
LVL 19

Expert Comment

by:jools
Comment Utility
try (this is a bit of a wild stab in the dark and used to work on other systems).

echo "subject: Firewall is down. $v_datetime" | mail <email>
0
 
LVL 19

Expert Comment

by:jools
Comment Utility
errr.... scratch that, just logged into a system and it didnt work... at all! <grin>
0
 
LVL 14

Expert Comment

by:sjm_ee
Comment Utility
You said "This command USED to work fine." - so what changed? Nothing you know of? Go deeper. Things don't change for no reason. Something did something.
0
 

Author Comment

by:cdomanski
Comment Utility
I've tried to send the same message to an internal AIX user, and they get the subject.

As another test, I've sent the same message to an external user again and checked my firewall log, and I see the message & subject pass by in the log.

Somewhere while in the "Internet", the subject always gets stripped?

ALSO, another clue, instead of /dev/null, if I pipe any file, of any size but 0 bytes, I get the subject. It only occurs with a NULL body.
0
 

Author Comment

by:cdomanski
Comment Utility
Thanks sjm_ee, I tried to think of everything, from patches to firewall, which I just posted above.

I was mostly wondering if anyone else has an AIX 5.3 box who could test this to see if I'm crazy or not.

These scripts have been in a cron & ksh scripts for a long time.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
So, do you have a problem of redirecting input from a 0 byte file rather than /dev/null?
0
 
LVL 2

Expert Comment

by:rammaghenthar
Comment Utility
Hi  cdomanski
       "mail -s "Firewall is down. $v_datetime"  <Email>   < /dev/null".
this command is looks like passing null files to mail box.that is why you might get null mail.


mail -s "Unexpected termination of HACMP cluster services" root << EOT
Add your mail message text here.
Do not remove the next line - it terminates the mail message text
EOT

the method has worked for me . If you want can try this also.



0
 
LVL 14

Expert Comment

by:sjm_ee
Comment Utility
Passing a null file to "mail" should work. I assume that the surrounding double quotes are not in the script. So let us break it down. Does this work?

mail -s "Test" name@host.com </dev/null

Does it work from a shell login? Does it work in the script? It should work from both. Unless someone changed you mail relay to discard email with no body ... so also try it like ramma suggested:

mail -s "Test" name@host.com <<!
Body
!
0
 

Author Comment

by:cdomanski
Comment Utility
I have tried using the zero byte file with the same results I.E. no subject.   I don't want to add a text to the body of the message as the subject is all that is needed.

0
 

Author Comment

by:cdomanski
Comment Utility
hi sjm_ee,

mail -s "Test" name@host.com </dev/null  AND
mail -s "Test" name@host.com <<!
Body
!

Do not work UNLESS I put something in the body.  

If the message is sent without a body it arrives with no subject.  It does not work from a shell log in nor does it work in a script.  I don't want to put anything in the body.  I only want the subject.

Thanks guys!

0
 
LVL 14

Expert Comment

by:sjm_ee
Comment Utility
Well it works on every 5.2 and 5.3 I can get to - with the usual message "Null message body; hope that's ok". Check that you are using /usr/bin/mail and not a different one. Then try it as follows:

mail -v -s "Test" name@host.com </dev/null
0
 
LVL 14

Accepted Solution

by:
sjm_ee earned 125 total points
Comment Utility
Well it works on every 5.2 and 5.3 I can get to - with the usual message "Null message body; hope that's ok". Check that you are using /usr/bin/mail and not a different one. Then try it as follows:

mail -v -s "Test" name@host.com </dev/null
0
 

Author Comment

by:cdomanski
Comment Utility
Thanks sjm_ee,

BTW:  When you use the -v flag, what version of sendmail are you using?

I get this message, and I'm wondering if this is the problem:
Warning: .cf file is out of date: sendmail AIX5.3/8.13.4 supports version 10, .cf file is version 9Warning: .cf file is out of date: sendmail AIX5.3/8.13.4 supports version 10, .cf file is version 9

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now