How to send mails based on email ids residing in table?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to send mails based on email ids residing in table?
# 1  
Old 08-31-2013
How to send mails based on email ids residing in table?

Hello Gurus,
I have one table which consists of two field:-

xxxx email1,email2,email3
yyyy email4,email1,email2

I want to to send mails by using mailx command.
But how do I get each and every mail ids from table against each prog_name
I have used sql query and stored the email field values at text file.
# 2  
Old 08-31-2013
Do you need the email IDs to be read from the text file or from the database?

From the file, it is pretty much easy. From the database, you can use SQL Plus to read the field values from the database and store it in a variable for further processing. Use this link for code samples on how to use SQL Plus in Unix.
# 3  
Old 09-01-2013
I want the mail ids to be read from a text file.

# 4  
Old 09-01-2013
What do you mean by

Originally Posted by pokhraj_d
But how do I get each and every mail ids from table against each prog_name
? Please explain in detail also supplying examples.
# 5  
Old 09-03-2013
1. Get the program name from user
2. Assign it to a variable
3. Search for the program name in the file(say input.txt)
grep -i $program_name input.txt

4. Extract required information from step 3 using


Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell Script to read hive table and send email

HI Team, I am working on reading hive table and send email in email body using shell script, can you please help on fixing the errors: I have 6 columns in my hive table and trying to send the email in the mail body. below script: #!/bin/bash hive -e 'SELECT count(*) from db.table' >... (4 Replies)
Discussion started by: Mi4304
4 Replies

2. Solaris

How to output the prstat into table and send through email?

Hi how to send below prstat script output into table format and send through email? prstat|awk '{ if ($9 >= 5) print $0 }' (17 Replies)
Discussion started by: tharmendran
17 Replies

3. Shell Programming and Scripting

Email IDs added to .mailrc aliases not receiving mails

hi, I added an email id to a list of existing aliases in .mailrc on my unix box, using vi editor. However, the new id has not been receiving any mails from the box. Kindly help as to what needs to be done here. Does the box need to be rebooted for these changes to reflect? Is there any other... (5 Replies)
Discussion started by: qwerty000
5 Replies

4. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

5. Shell Programming and Scripting

Send email based on row count

i have below code to count number of rows in file1.txt, if the row count is more than one then i have sending an email along with file1.txt attached and fail the process(do nothing if count is <=1), if I test individually count part works good but when i include the email part its not working,... (1 Reply)
Discussion started by: srini_106
1 Replies

6. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

7. Shell Programming and Scripting

Send email recipient based on filename

Hi All can someone help please create a bash script. Here's a scenario: 1. I have a directory where it's a destination for scanned documents. e.g. /dest/scan 2. The filename is in the form IDNumber_Category. e.g. 123456_notes.pdf 3. The first part of the script is to rename the... (1 Reply)
Discussion started by: aemestech
1 Replies

8. Shell Programming and Scripting

Send Email to group ids

hi, I want to send mail to DL... i am sending email to single id using mailx .. how to send to group of ids? :confused: i am using a file which conatins all the ids, is there any other way to send mail without creating the DLfile? DL=path\file.txt mailx -s "Info BG is now... (4 Replies)
Discussion started by: sreelu
4 Replies

9. UNIX for Dummies Questions & Answers

Sending mails to various users without hard coding the email IDS

Hi Can any one help me out ? I am trying to send an autogenerated mail with an attachment to bulk of users using 'MAILX' and 'UNENCODE' . I have used it as follows X " ( cat /sastemp/body.txt; uuencode Test.xls.gz Test.xls.gz ) | mailx -s 'Testing' ' , ' " ... (9 Replies)
Discussion started by: manas6
9 Replies

10. Shell Programming and Scripting

How to send attachment to web-based email client using mailx

hi, i am trying to send mail with attachment to web-based email client like using mailx. the problem is it is displayed in content rather than as attachment. the code i am using is as follows, uuencode test1.txt test1.txt | mailx -s "test only" does anyone... (1 Reply)
Discussion started by: randomcz1
1 Replies
Login or Register to Ask a Question