unix email attachments in web mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting unix email attachments in web mail
# 1  
Old 02-28-2012
unix email attachments in web mail

Hi,

Request you to please help on my issue.

My issue is: We are able to send the log files as an email attachment. We are able to get the attachment in our inbox. But when we try to see in web mail, instead of the attachment, junk characters are displaying.
Appreciate your help.

Regards,
Srinivas
# 2  
Old 02-28-2012
If you search the site, there are lots of e-mail examples. Try this to attach a file called data.txt:
Code:
#!/bin/ksh

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

# 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

exit 0


Last edited by gary_w; 04-03-2012 at 11:03 AM..
# 3  
Old 02-28-2012
Hi Gary,

Thank you for the update.
Used the code specified by you. But its not working.

I have used the following:
Code:
FILE="$APPLCSF/$APPLLOG/l$V_REQUEST_ID.req"

Here FILE is a var that contains the log file.
Code:
unix2dos -437 -ascii $FILE $FILE

uuencode $FILE $FILE) | mailx -s "$V_EMAIL_SUB" "$V_EMAIL_ADDRESS"

Is there anything im missing.

Regards,
Srinivas

Last edited by Franklin52; 02-29-2012 at 03:13 AM.. Reason: Please use code tags for code and data samples, thank you
# 4  
Old 02-28-2012
If you're going to remove the print, remove the extra ) on the other side too.
# 5  
Old 02-28-2012
Hi Corona,

Actually im trying to corelate the same to my code. its not working as expected.

still junk chars displaying instead of the attachment in web email.

Regards,
Srinivas

Last edited by gi.srinivas; 02-28-2012 at 04:18 PM..
# 6  
Old 02-28-2012
The code you posted wouldn't have worked at all due to the extra )...
# 7  
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
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
Login or Register to Ask a Question