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.
If you search the site, there are lots of e-mail examples. Try this to attach a file called data.txt:
#!/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
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
There is much variation in "mailx". Please post what Operating System and version you have.
In mine I need a "-m" switch to turn off Mime headers.
Also, after removing all the comments from your script, you never execute "unix2dos". In the example earlier the "unix2dos" command line was wrong.
The pipeline sequence snippet would be something like:
Notice that I have given the attachment a ".txt" extension. This is quite likely to be your problem because your original file has a ".req" extension and a huge full path name.