Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2728
  • Last Modified:

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

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
cdomanski
Asked:
cdomanski
  • 6
  • 4
  • 2
  • +2
1 Solution
 
omarfaridCommented:
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
 
cdomanskiAuthor Commented:
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
 
joolsCommented:
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
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!

 
joolsCommented:
errr.... scratch that, just logged into a system and it didnt work... at all! <grin>
0
 
sjm_eeCommented:
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
 
cdomanskiAuthor Commented:
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
 
cdomanskiAuthor Commented:
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
 
omarfaridCommented:
So, do you have a problem of redirecting input from a 0 byte file rather than /dev/null?
0
 
rammaghentharCommented:
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
 
sjm_eeCommented:
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
 
cdomanskiAuthor Commented:
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
 
cdomanskiAuthor Commented:
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
 
sjm_eeCommented:
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
 
sjm_eeCommented:
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
 
cdomanskiAuthor Commented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 6
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now