954,546 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Subject part is not coming while sending mail

Hi gurus,
I have a script like this.
echo "$file1 does not exists " | mail -s "No File found for $file1" [email]floyd@gmail.com[/email]

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

pinkfloyd
Newbie Poster
4 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

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:

(echo "Subject: No File found for $file1";echo "$file1 does not exists " )|mail you@you.com


Hope that helps some,

Thanks,

Mike

eggi
Posting Pro in Training
400 posts since Oct 2007
Reputation Points: 102
Solved Threads: 47
 

It works.Thanks a lot Mike.

pinkfloyd
Newbie Poster
4 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

Good deal!

Glad I could help :)

, Mike

eggi
Posting Pro in Training
400 posts since Oct 2007
Reputation Points: 102
Solved Threads: 47
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You