Subject part is not coming while sending mail

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2008
Posts: 4
Reputation: pinkfloyd is an unknown quantity at this point 
Solved Threads: 0
pinkfloyd pinkfloyd is offline Offline
Newbie Poster

Subject part is not coming while sending mail

 
0
  #1
Oct 24th, 2008
Hi gurus,
I have a script like this.
echo "$file1 does not exists " | mail -s "No File found for $file1" floyd@gmail.com

It is sending the mail.But subject part is not coming.Only the content is coming($file1 does not exists ).Can anyone help me out?
Floyd
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: Subject part is not coming while sending mail

 
0
  #2
Oct 24th, 2008
Hey there,

Depending on what "mail" you're using (revisions, etc), you may be dealing with an issue that is caused by passing the -s "SUBJECT" argument to mail.

If you have it on your system, you can change that line to read "mailx" instead of "mail" and it should work perfectly. Otherwise, you can pipe output to mail and include the subject line there, like this:

Shell Scripting Syntax (Toggle Plain Text)
  1. (echo "Subject: No File found for $file1";echo "$file1 does not exists " )|mail you@you.com

Hope that helps some,

Thanks,

Mike
Last edited by eggi; Oct 24th, 2008 at 8:34 pm. Reason: manual code tags ruined formatting of output
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 4
Reputation: pinkfloyd is an unknown quantity at this point 
Solved Threads: 0
pinkfloyd pinkfloyd is offline Offline
Newbie Poster

Re: Subject part is not coming while sending mail

 
0
  #3
Oct 27th, 2008
It works.Thanks a lot Mike.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: Subject part is not coming while sending mail

 
0
  #4
Oct 27th, 2008
Good deal!

Glad I could help

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum


Views: 714 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC