| | |
Subject part is not coming while sending mail
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 4
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
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:
Hope that helps some,
Thanks,
Mike
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)
(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!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Good deal!
Glad I could help
, Mike
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!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
![]() |
Similar Threads
Other Threads in the Shell Scripting Forum
- Previous Thread: csh loop script to start a process if it has stopped
- Next Thread: Problem with if condition
Views: 714 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Shell Scripting





