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

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

It works.Thanks a lot Mike.

Good deal!

Glad I could help :)

, Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.