The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Why no attachment seen??? Amruta Pitkar UNIX for Dummies Questions & Answers 2 04-27-2009 06:22 PM
sendmail attachment jayman Shell Programming and Scripting 3 08-05-2008 02:20 AM
attachment using sendmail vastare SUN Solaris 4 01-03-2006 12:56 PM
How To Add Attachment to Mail lesstjm Shell Programming and Scripting 3 12-06-2005 11:24 AM
Mailing an attachment gayath3 Shell Programming and Scripting 0 03-18-2005 06:09 AM

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 01-15-2009
kenkanya kenkanya is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 18
Using Sendmail (& attachment)

Hi,
This is my first thread.
Iam trying the following:
OS: Sun
Database: DB2, Informix, Oracle

* Get the status of the database (using database command line options)
* pipe to a text file
* send mail of the text file to receiptents.

TODO1:
First step i tried to send a test message.
sendmail myname@domain.com
This is test message (ctrl-d)

But when i check my mail box, i did not receive any message.
Where am i wrong? Any settings need to be done?

TODO2:
I have written a small shell script to get the status of the database (informix) and pipe it to a text file

something like:
onstat -d > track.txt

So the file "track.txt" will have the output of the database status.
I will be running this shell script using crontab say every 2 hours or so.

First i would like to add this file track.txt to the sendmail and send it to the receiptents.

Any leads how to add the file?

thanks
  #2 (permalink)  
Old 01-16-2009
mgessner mgessner is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 50
Possible solution to first part

Instead of using 'sendmail', perhaps you want just 'mail'.

Try this and see how far it gets you:

# ls > ls.txt
# mail -s "ls output" youremail@yourhost < ls.txt

Then check your mail.

If you're sending to multiple recipients you may want to check to see if your mailer supports lists. Otherwise you'll have to write a script that opens up a file of recipients and loops over them:

onstat -d > onstat.txt
for r in `cat alertemails.txt`
do
mail -s "alert email" $r < onstat.txt
done

I think that will likely do what you want.

Good luck.
  #3 (permalink)  
Old 01-16-2009
pupp's Avatar
pupp pupp is offline Forum Staff  
cap_10hdx 1
  
 

Join Date: Feb 2008
Location: Jersey Shore
Posts: 562
mailx is another option.
  #4 (permalink)  
Old 01-19-2009
kenkanya kenkanya is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 18
Quote:
Originally Posted by mgessner View Post
Instead of using 'sendmail', perhaps you want just 'mail'.

Try this and see how far it gets you:

# ls > ls.txt
# mail -s "ls output" youremail@yourhost < ls.txt

Then check your mail.

If you're sending to multiple recipients you may want to check to see if your mailer supports lists. Otherwise you'll have to write a script that opens up a file of recipients and loops over them:

onstat -d > onstat.txt
for r in `cat alertemails.txt`
do
mail -s "alert email" $r < onstat.txt
done

I think that will likely do what you want.

Good luck.
Thanks for your direction. I did check and the sendmail daemon was not running. The Systems dept guys had started the daemon and now iam able to send mail to single id.
Iam now looking at (as you specified) to sending mails to multiple recipitents.

1. If i understood right, i create a "alertemails.txt" which contains the list of emails and use this as per your script?
2. I put this in a script, execute with cron job and its done, right?

Also the cron daemon is not running and they (system guys) are looking at it. Once iam done, i shall update.
Closed Thread

Bookmarks

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 11:45 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