Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-10-06
15
Medium Priority
?
2,706 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +2
15 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 22654100
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
ID: 22654335
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
ID: 22654973
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 19

Expert Comment

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

Expert Comment

by:sjm_ee
ID: 22655208
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
ID: 22655212
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
ID: 22655232
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 22656219
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
ID: 22656723
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
ID: 22657372
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
ID: 22668970
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
ID: 22669112
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
ID: 22685434
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 500 total points
ID: 22685597
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
ID: 22686124
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

636 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