The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to send a file in email dr46014 Shell Programming and Scripting 2 12-10-2007 08:38 AM
error-when trying to send the message thru email. MARY76 Shell Programming and Scripting 5 02-06-2007 04:10 PM
send a message through email to 5 people using unix script. MARY76 UNIX for Advanced & Expert Users 3 02-05-2007 03:42 PM
send a message through email to 5 people using unix script? MARY76 Shell Programming and Scripting 2 02-05-2007 03:29 PM
How to send file contents to email teaspoon_ver2 UNIX for Advanced & Expert Users 4 01-11-2007 04:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-07-2007
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
how to send contents of a file to email as a message

i have a file new1.txt
i want to send the contents of that file as a message to email ali@sms.com

i m using ksh script.........

plz help me
  #2 (permalink)  
Old 12-07-2007
varungupta varungupta is offline
Registered User
  
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Quote:
Originally Posted by ali560045 View Post
i have a file new1.txt
i want to send the contents of that file as a message to email ali@sms.com

i m using ksh script.........

plz help me
Hey,

use following ...

Subject="mailing you buddy.."
MAIL_RECIPIENTS="ali@sms.com, xyz@abccom"

cat new1.txt | mailx -s "$Subject" $MAIL_RECIPIENTS

Thanks
  #3 (permalink)  
Old 12-07-2007
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
actually i have a file

#!/bin/ksh

echo " ************************************ " >> perst
echo " The following apps are running currently indicated by their number" >> perst



for i in Archiver1 Cleaner1 Archiver2 Interpolation DBMaint ImportAdapter_CC Extrapolation ZeroConsumptionReport DBSyncListener TnsProvAdapterCheckConfig
do
count=0
count=`ps -aef | grep java | grep $i | wc -l`
echo $i $count >> perst
ps -aef | grep java| grep $i >> /tmp/new1.txt
done
echo " ********************************************** " >> perst
mail -s "Plz find the attachment for the currently Running application" naveed@cap.com < /tmp/new1.txt
Hi,
This Attachment contains the list of all the Applications Running Currently on
mdcaedn03.tu.com

Thanks
Ali Naveed
-------------------------------------------------------------------------can u tell me why i m not getting the content of file new1.txt in my mail
  #4 (permalink)  
Old 12-07-2007
varungupta varungupta is offline
Registered User
  
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Quote:
Originally Posted by ali560045 View Post
actually i have a file

#!/bin/ksh

echo " ************************************ " >> perst
echo " The following apps are running currently indicated by their number" >> perst



for i in Archiver1 Cleaner1 Archiver2 Interpolation DBMaint ImportAdapter_CC Extrapolation ZeroConsumptionReport DBSyncListener TnsProvAdapterCheckConfig
do
count=0
count=`ps -aef | grep java | grep $i | wc -l`
echo $i $count >> perst
ps -aef | grep java| grep $i >> /tmp/new1.txt
done
echo " ********************************************** " >> perst
mail -s "Plz find the attachment for the currently Running application" naveed@cap.com < /tmp/new1.txt
Hi,
This Attachment contains the list of all the Applications Running Currently on
mdcaedn03.tu.com

Thanks
Ali Naveed
-------------------------------------------------------------------------can u tell me why i m not getting the content of file new1.txt in my mail
Hey,

Above Boldfaced, shows redirection but whats the command in it ??
it should be ..
mail -s "Plz find the attachment for the currently Running application" naveed@cap.com < cat /tmp/new1.txt

Otherwise use pipe as I gave the example previously..

cat /tmp/new1.txt | mail -s "Plz find the attachment for the currently Running application" naveed@cap.com


Try this one..hope it'll work.
  #5 (permalink)  
Old 12-07-2007
ramkrix ramkrix is offline
Registered User
  
 

Join Date: Dec 2007
Location: TamilNadu,INDIA
Posts: 52
Smile

instead of using the mail command, use mailx.

it should be like this:

mailx -s "Plz find the attachment for the currently Running application" naveed@cap.com < /tmp/new1.txt

I just checked the functionality of this in my unix environment:

echo "Hi hw are you" > /tmp/new1.txt
mailx -s "kshfks" myid@domain.com < /tmp/new1.txt

And I got the mail in my domain
  #6 (permalink)  
Old 12-07-2007
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
thanks now i m getting the message but after that i have written some messages
-------------------------------------------------------------

Hi,
This Attachment contains the list of all the Applications Running Currently on
mdcaedn03.tu.com

Thanks
Ali Naveed
-------------------------------------------------------------------------------
above one its not displaying, can u tell me the syntax
Closed Thread

Bookmarks

Tags
mailx, mailx attachment

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0