Visit Our UNIX and Linux User Community


Send email attachment using Operating System Script(UNIX) in Oracle Alerts


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Send email attachment using Operating System Script(UNIX) in Oracle Alerts
# 1  
Old 10-02-2015
Question Send email attachment using Operating System Script(UNIX) in Oracle Alerts

Good Day

Kindly assist:

I am creating an Alert that will notify supervisors of staff members who are due for probation report. I am using Operating System Script(Unix) as source.I have already developed the script.

Now the challenge is if there are 3 employee records then the alert will send 3 different emails with each employee record. Now I want to add a condition that will iterate through records and send only one email listing all employee records.


Code:
if [[ -n "&employee_number " ]]
then
echo "Employee Number:&employee_number"
fi |mutt -s "Attachment" -a /u01/ProgressReport.doc  &tt

Your assistance will be highly appreciated.

Thanking you in advance

Moderator's Comments:
Mod Comment please use for your code and data, code tags, thanks

Last edited by vbe; 10-02-2015 at 09:22 AM..
# 2  
Old 10-02-2015
Based on that small snippet one can only guess what you're doing in your script.

Collect all messages in one file, and, at the end, send this one file to the recipients.
# 3  
Old 10-02-2015
Thank you for the respose.I am still new to Unix.PLease tell how am i suppose to write all messages into one file.

See below the SQL statement for the alert:
select papf.employee_number
, papf.full_name
, papf.start_date date_joint
, pps.ADJUSTED_SVC_DATE
, paaf.date_probation_end
-- , papfs.employee_number
, papfs.full_name supervisor
, papfs.email_address supervisor_email_address
, paaf.probation_period
, haou.name
'test@gmail.com' mail

into
&employee_number
, &full_name
, &date_joint
, &adj_serv_date
, &prob_end_date
, &supervisor
, &supervisor_email_address
, &probation_period,
, &department
,&tt
from apps.per_all_assignments_f paaf,
apps.per_all_people_f papf,
apps.hr_all_organization_units haou,
apps. per_all_people_f papfs,
apps.per_periods_of_service pps
where paaf.person_id = papf.person_id
--and papf.employee_number = '720040049'
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date
and trunc(sysdate) between papfs.effective_start_date and papfs.effective_end_date
and haou.organization_id = paaf.organization_id
and papfs.person_id = paaf.supervisor_id
and pps.period_of_service_id = paaf.period_of_service_id
and paaf.date_probation_end is not null
and ( months_between ( date_probation_end, to_date('30-SEP-2015','DD/MM/YYYY') )= 9 -- trunc(sysdate)+7
or
months_between ( date_probation_end, to_date('30-SEP-2015','DD/MM/YYYY') ) = 6
or
months_between ( date_probation_end, to_date('30-SEP-2015','DD/MM/YYYY') ) = 3
or
months_between ( date_probation_end, to_date('30-SEP-2015','DD/MM/YYYY') )= 0)
and probation_period = 12
and paaf.primary_flag = 'Y'

then action type is as follows(I wanted to paste the PRINTSCREEN here but I couldnt):

Action Type : Operating Sytem Script

Text : if [[ -n "&employee_number" ]]
then
echo "Employee Number: &employee_number"
fi|mutt -s "Attachment" -a /u01/ProgressReport.doc &tt

Thanks.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #114
Difficulty: Easy
Linux was derived from the Unix design philosophy.
True or False?

10 More Discussions You Might Find Interesting

1. HP-UX

Unable to send attachment with html tables in UNIX shell script

Heyy, any help would be grateful.... LOOKING FOR THE WAYS TO SEND AN EMAIL WITH ATTACHMENT & HTML TABLES IN BODY THROUGH SHELL SCRIPT (LINUX)..NOT SURE, IF WE HAVE ANY INBUILT HTML TAG OR UNIX COMMAND TO SEND THE ATTACHMENTS. KINDLY HELP below is small script posted for our understanding..... (2 Replies)
Discussion started by: Harsha Vardhan
2 Replies

2. Shell Programming and Scripting

How to check email with attachment received or not from UNIX shell script?

Hello Guys, Here is the requirement!! I want to check the mail with attachment received or not through unix scripting. And send an notification email when mail with attachment already received. Any thoughts on this is much appreciated!! Regards, Harry (0 Replies)
Discussion started by: dharry2017
0 Replies

3. Shell Programming and Scripting

Not able to send attachment with the email

Hi All, The below code is working fine for me. mailx -s hello abc@xyz.com <<EOT Hello !!! How are you? Regards Rahul EOT But i am not able to send csv file with the mail .Getting just themail but not the attachment. uuencode /path/s1.csv | mailx -s hello abc@xyz.com <<EOT... (9 Replies)
Discussion started by: rafa_fed2
9 Replies

4. Shell Programming and Scripting

Logic to send email alerts only 5 times a day

Hi, I have written below disk space monitoring script to monitor disk space every minute. I have scheduled this script through cron. But now my problem is this script alerts the users continuously until the space is freed up. These emails are filling up the inbox exponentially until the space... (3 Replies)
Discussion started by: svajhala
3 Replies

5. Shell Programming and Scripting

unable to send an email attachment

i know its pretty repeated query, but i need to post it in this new thread coz i need it urgently uuencode /var/tmp/chandra/emaillist.txt emaillist.txt | mail -s "message with encoded attachment" am unable to send the attachment emaillist.txt present in the path /var/tmp/chandra/ Is... (11 Replies)
Discussion started by: cmaroju
11 Replies

6. AIX

Send email from unix (AIX) with PDF attachment

I am using the following command to send PDF attachment with a mail. uuencode <attachment.pdf> <attachment.pdf>|mailx -s <subject> <mail_id> < <Message_file.txt> This one send the message with attachment. I would like send PDF attachment with the mail Can any one help with this issue ? ... (0 Replies)
Discussion started by: sunjup
0 Replies

7. Shell Programming and Scripting

Send email with attachment in form of excel in unix

Hi, I have a shell script which send email with an attachment in the form of an email. However, the when I open the attachment, all the data comes in one column. How do I format the data in the excel sheet while sending the email? Thanks (8 Replies)
Discussion started by: bdebroy
8 Replies

8. Shell Programming and Scripting

send email from unix with attachment

Hello All, This is a common question that I found lot of results in the forums. I am trying to use uuencode to attach a file and send email. I have no issues sending email, but not able to attach any files using sendmail. Is uuencode part of sendmail or does 'uuencode' utility need to be... (1 Reply)
Discussion started by: chiru_h
1 Replies

9. Shell Programming and Scripting

script that will send and email attachment

I'm looking for a sample of some code that will take the output from a file and generate an email that will include that text as an attachment. the script is in the borne shell. any help? (2 Replies)
Discussion started by: davels
2 Replies

10. UNIX for Dummies Questions & Answers

How do I send a file as an attachment (gzip file) on a Unix system

Hi, How do I send a file as an attachment (gzip file) on a Unix system ? Using sendmail. Please help me. :confused: (3 Replies)
Discussion started by: lacca
3 Replies

Featured Tech Videos