Sponsored Content
Top Forums Shell Programming and Scripting unix email attachments in web mail Post 302602998 by gi.srinivas on Wednesday 29th of February 2012 12:12:55 AM
Old 02-29-2012
Hi Corona,

Actually the code is like this as shown below:
Code:
V_EMAIL_ADDRESS=$5
V_REQUEST_ID=$6
V_EMAIL_SUB=$7
V_COMPLETION_STATUS=$8
V_USER_NAME=$9
V_COMPLETION_TIME=${10}

echo "Email parameter: $5"
echo "Request parameter: $6"
echo "Subject: $7"
echo "Completion Status: $8"
echo "User Name: $9"
echo "Completion Time: ${10}"

#echo "-------------------------------------------------------"
#V_EMAIL_ADDRESS="Emailparameter"
echo "-------------------------------------------------------"

echo "-------------------------------------------------------"
#V_EMAIL_ADDRESS="srinivas.ginyarpalli@oracle.com"
echo "-------------------------------------------------------"
echo "Email Address  "$V_EMAIL_ADDRESS

#V_EMAIL_SUB="$V_EMAIL_SUB:$V_REQUEST_ID"
#V_EMAIL_SUB="XXCB Ricoh Request status Report for RIF Request ID: $request_id"
echo "Email Subject:"$V_EMAIL_SUB
echo "Request id:"$V_REQUEST_ID
echo "Completion Status:"$V_COMPLETION_STATUS
echo "User Name:"$V_USER_NAME
echo "Completion Time:"$V_COMPLETION_TIME


#echo "Out file"o$request_id
#/usr/bin/uuencode $APPLCSF/out/$CONTEXT_NAME/o$request_id.out XXCB_ERROR_WARNING_REPORT.out|mailx -s "${V_EMAIL_SUB}" ${V_EMAIL_ADDRESS}

FILE="$APPLCSF/$APPLLOG/l$V_REQUEST_ID.req"

echo $FILE

###############
# Convert line feeds from the source and write to attach.out.
#unix2dos -437 -ascii data.txt attach.out
#unix2dos -437 -ascii $FILE

# Now uuencode attach.out and call it data.txt for the attachment name.
#(print "Please review the attached file";uuencode attach.out data.txt) | mailx -s "Test" myemail@mydomain.com
###############

############################################
if test -r $FILE
then
(echo "Hi,"
echo "Please find the Errored Concurrent Program details below:"
echo ""
echo "---------------------------------------------------------"
echo "Email Subject:"$V_EMAIL_SUB
echo "Request id:"$V_REQUEST_ID
echo "Completion Status:"$V_COMPLETION_STATUS
echo "User Name:"$V_USER_NAME
echo "Completion Time:"$V_COMPLETION_TIME
echo "---------------------------------------------------------"
echo ""
echo "Thanks and Regards,"
echo "System Administrator"
uuencode $FILE $FILE) | mailx -s "$V_EMAIL_SUB" "$V_EMAIL_ADDRESS"

#(echo "Email text" ; uuencode $FILE  $FILE) | mailx -s  "$V_EMAIL_SUB" $V_EMAIL_ADDRESS
 #mailx -s  "$SUBJECT" -c   $EMAILCC $EADDRESS
 #uuencode  $FILE email_$V_REQUEST_ID.txt > eout_$V_REQUEST_ID.txt
 
 #cat $XBOL_TOP/bin/message.txt FILE > Consign_$V_REQUEST_ID.txt
 #cat $FILE > Consign_$V_REQUEST_ID.txt
 echo " ---- Send Email to --> "$V_EMAIL_ADDRESS
 #mailx -s "$V_EMAIL_SUB" $V_EMAIL_ADDRESS < Consign_$V_REQUEST_ID.txt
 #reerecho " ---- Removing the runtime files ----"
 #rm eout_$V_REQUEST_ID.txt
 #rm Consign_$V_REQUEST_ID.txt
 echo " ------------------------------------"
fi
############################################

#cat $FILE | mailx -s "${V_EMAIL_SUB}" ${V_EMAIL_ADDRESS}

if [[ $? -ne 0 ]]; then
   echo "Error: Unable to email $FILE to $V_EMAIL_ADDRESS"
else
   echo "Success: Sent $FILE to $V_EMAIL_ADDRESS"
fi

The issue is that the attachment is fine if we open thru our inbox. If we open the same thru web mail, then the junk chars its showing.
Regards,
Srinivas

Last edited by Franklin52; 02-29-2012 at 03:14 AM.. Reason: Please use code tags for code and data samples, thank you
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mail attachments

I'm writing scripts on HP-UX. Is there a way to attach a file to a mail message. I don't want to imbed the data in the mail message. (1 Reply)
Discussion started by: Multithreaded
1 Replies

2. UNIX for Dummies Questions & Answers

Blocking email attachments

Dear Friends, Is there any way to block incoming emails with attachments or move them in specified directory on. Can anybody help? Yours kam (10 Replies)
Discussion started by: kamlakar
10 Replies

3. UNIX for Dummies Questions & Answers

Email Attachments

I use metasend to send an attachment to an email. The attached file has a .csv extension however when the email is received the extension is changed to .att. Does anyone know why ? I need the name to remain as .csv (1 Reply)
Discussion started by: fabbas
1 Replies

4. UNIX for Dummies Questions & Answers

Can you e-mail files as attachments from unix to windows?

Another question if you guys don't mind, if you do this: cat * |mailx -s xxxxx <email> it will send files to a email address displayed as sdout, is there a quick way to send files to a e-mail address but as a attachement? Say if I renamed files to .xls on unix, and sent them to a e-mail... (4 Replies)
Discussion started by: nj78
4 Replies

5. AIX

Send mail attachments and have a mail body

Hi, How can I send mail attachments from shell script (AIX) and have a mail body as well ? Thanks in advance. (1 Reply)
Discussion started by: shibajighosh
1 Replies

6. Solaris

mail with attachments

I want to send a mail with three attachments, but nothing happened. I tried it with mail and mailx. Are there special options for these commands or is it not possible to send mails under Solaris with attachments? Must there be special adjustments in the environment? Can anyone give an... (6 Replies)
Discussion started by: ninjadan
6 Replies

7. HP-UX

Sending Unix files as attachments in an email

Hi, I am executing the following command in order to send a file as an attachment: mailx -s "Subject" emailID@xyz.com < Testfile.txt Instead of attaching the file Testfile.txt, it is writing the contents of the file in the email message body. Please advise on how I can send the file as an... (7 Replies)
Discussion started by: sangharsh
7 Replies

8. Shell Programming and Scripting

Reading Mail attachments using unix

:wall:hi all, please somebody can help me out in reading the pop3 mail attachments or saving it locally i have a mail account where i receive .csv attachments i need to read that attachments and process them. any sample code can be much appriciated Removed email :wall: (3 Replies)
Discussion started by: srikanthkadapal
3 Replies

9. Shell Programming and Scripting

Use of java mail to send email from UNIX

Can someone help me to understand how to configure java mail on unix or what is syntex for that to put in script so email can be sent. earlier i was using 'send mail' to send email and not SMPT is stopped in unix machine and they asked us to use java mail. Before I was using this ... (0 Replies)
Discussion started by: mirwasim
0 Replies
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy