I have written the following code ...to include the Subject, Message Body and Attachment with sendmail.
When I send mail from my Unix account to diffrent mail servers like Yahoo , Hotmail etc..I recv the Message Body but there is no newline character at the end of each line....
Also I recv the attachment too..which can be opened and seen properly..but the email is followed by a series of junk characters....WHY ???????????
Can anyone help me PLEASE..I am stuck...
Code:
#!/usr/bin/ksh
set -x
#Author - Amruta Pitkar - 15/Aug/2006
#Version - 1.0
#Subject : This is a great trial.
#Message Body : is a e28931.htm
#Attachment : only one file : test.xls
#RecivAe Return whther file sent successfully or not
#Get the send options
subject="HOPE THIS WORKS"
sendto="amrutapitkar@yahoo.com"
attachfile="test.rtf"
msgbody="e28931.txt"
#Creeate message boundary number based on process id
boundary=JPR$$
#Create header part of the email
echo "From:""$sendername""<"$senderaddress">">>$tempfile
echo "To:"$sendto>>$tempfile
echo "Mime-Version:1.0"$version>>$tempfile
echo "Content-Type:Multipart/mixed;boundary=Message-Boundary-"$boundary>>$tempfile
echo "Subject:"$subject>>$tempfile
#Delivery Receipt is returned here
echo "Return-Receipt-To:""$sendername""<"$senderaddress">">>$tempfile
echo "Message-Id:<"$messid"."$senderdomain>>$tempfile
echo "">>$tempfile
echo "">>$tempfile
echo "--Message-Boundary-"$boundary>>$tempfile
echo "Content-type:text/html">>$tempfile
echo "Content-transfer-encoding: 7BIT">>$tempfile
echo "Content-Disposition:inline">>$tempfile
#echo "Content-Description: Read Me First">>$tempfile
echo "">>$tempfile
echo "">>$tempfile
#Create Msg body part of the email file
cat $msgbody>>$tempfile
echo "">>$tempfile
echo "Please find attached the File "$attachfile>>$tempfile
echo "">>$tempfile
#uuencode the attachmetn
echo "--Message-Boundary-"$boundary>>$tempfile
echo "Content-type:Application/Octet-Stream;name=$attachfile">>tempfile
echo "Content-disposition:inline;filename=$attachfile">>$tempfile
echo "Content-transfer-encoding: X-UUencode">>$tempfile
echo "">>$tempfile
uuencode $attachfile $attachfile >>$tempfile
##Send email message straight to sendmail
/usr/lib/sendmail $sendto < $tempfile
For this the ouput on Yahoo is
Dear Mrs.abcdefghijklmnopqrst Your report of 20060405 for your Account 28931373 is 8432121.27 and is available for viewing at E-Enable. Thank you. Please find attached the File test.rtf
Text Attachment [ Scan and Save to Computer | Save to Yahoo! Briefcase ]
{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New
Roman;}{\f78\froman\fcharset238\fprq2 Times New Roman
CE;}{\f79\froman\fcharset204\fprq2 Times New Roman Cyr;}
{\f81\froman\fcharset161\fprq2 Times New Roman
Greek;}{\f82\froman\fcharset162\fprq2 Times New Roman Tur;}{\f83\froman\fcharset177\fprq2 Times
New Roman (Hebrew);}{\f84\froman\fcharset178\fprq2 Times New Roman
(Arabic);}
{\f85\froman\fcharset186\fprq2 Times New Roman
Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\bl ue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\gree n0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
\ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0
Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title This is a
test}{\author Amruta Pitkar}
{\operator Amruta
Pitkar}{\creatim\yr2006\mo8\dy14\hr8\min51}{\revtim\yr2006\mo8\dy14\hr8\min51}{\version2}{\edmins1}{ \nofpages1}{\nofwords0}{\nofchars0}{\*\company
Singapore Telecom Ltd}{\nofcharsws0}{\vern8269}}
\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\d gmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\u seltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
\fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl
{\*\pnseclvl1
\pnucrm\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5
\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta
)}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta
)}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta
)}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta
)}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {This is a test.
\par This document will be sent as an attachment.
\par This is a Word Document.
\par Different documents such as .RTF, .PDF, and .DOC will be tried for
sending as an attachment.
\par HOPE IT WORKS.
\par }}
The junk at the end of the email is....
{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New
Roman;}{\f78\froman\fcharset238\fprq2 Times New Roman
CE;}{\f79\froman\fcharset204\fprq2 Times New Roman Cyr;}
{\f81\froman\fcharset161\fprq2 Times New Roman
Greek;}{\f82\froman\fcharset162\fprq2 Times New Roman Tur;}{\f83\froman\fcharset177\fprq2 Times
New Roman (Hebrew);}{\f84\froman\fcharset178\fprq2 Times New Roman
(Arabic);}
{\f85\froman\fcharset186\fprq2 Times New Roman
Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\bl ue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\gree n0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
\ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0
Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title This is a
test}{\author Amruta Pitkar}
{\operator Amruta
Pitkar}{\creatim\yr2006\mo8\dy14\hr8\min51}{\revtim\yr2006\mo8\dy14\hr8\min51}{\version2}{\edmins1}{ \nofpages1}{\nofwords0}{\nofchars0}{\*\company
Singapore Telecom Ltd}{\nofcharsws0}{\vern8269}}
\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\d gmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\u seltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
\fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl
{\*\pnseclvl1
\pnucrm\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5
\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta
)}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta
)}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta
)}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta
)}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {This is a test.
\par This document will be sent as an attachment.
\par This is a Word Document.
\par Different documents such as .RTF, .PDF, and .DOC will be tried for
sending as an attachment.
\par HOPE IT WORKS.
\par }}
These are the content of the attachment file...that are repeated.
How can I avoid this ????
When I open the same email in my MS_OutLook account I dont get junk characters.....
But when I open the email in hotmail and yahoo account ....junk characters follow....
Strange...
Can anyone help in this please......
Hi All,
I have a issue that we are getting Junk characters from source and i am not able to load that records to Database.
Line breakers
Junk Characters (Â and different every time)
Japanese Characters
Every time I am using grep command and awk -F "\007" to find them and delete that... (1 Reply)
Hello,
I am using a mailing statement in unix as follows
echo " Files are available at the designated FTP folder location \n \n $(ls *)"| mailx -m -s " files are available" X@y.com
But email is going to my junk folder instaed inbox. Can anyone pls advise..I need to get my email to... (1 Reply)
Hi,
I rebooted a Solaris 11 box and after that date stamp is coming in junk in almost all directories.
root@tstilp05 # ls -l
total 112
drwxrwxr-x 9 root sys 19 juin 1 03:10 adm
drwxr-xr-x 6 root sys 6 sept. 19 2012 ai
drwxr-xr-x 3 root bin ... (3 Replies)
Hi
I have to remove the junk characters from my file. Please help..
File content :
CURITY_CODE_GSD) FROM� DL_CB_SOD_EOD_VALUATION WHERE� ASOF (1 Reply)
I have script which send a mail with top output. The script look like
$ cat health.sh
#!/bin/sh
maillist="email address"
rm /home/rtq1/file
top -n 1 | head 15 > file
cat file | mailx -s "Daily Health Report from `hostname` ..." "${maillist}"
But now i am getting some junk characters along... (1 Reply)
Urgently ur help is needed.
Actually my req is i have an input file, that input file may have junk characters (^M, ^Z) etc...
eg:
cat file
name abc^Z addres
name2 msdmskd^Z address2
I want to validate the record and display where exactly this junk character resides.
I want to... (3 Replies)
Hi,
I have a file with data as given below
$cat file1
123|abc|345
345|def|567
The first record is good record. The second record has an invisible junk character like \032.
I was replace all the occurences of that invisible character with #.
I want to do this for a set of... (16 Replies)
Hi,
Is there anyway to find the junk characters in a file.Consider the file has data as given below:
123|abc^M|Doctor^C #record 1
234|def|Med #record 2
345|dfg^C|Wrong^V #record 3
The junk characters are highlighted and this is a pipe delimited file.
Is there anyway to... (20 Replies)
Guys,
can you help me in removing the junk character "^S" from the below line using perl
Reference Data Not Recognised ^S Where a value is provided by the consuming system, which is not reco
Thanks,
M.Mohan (1 Reply)
Dear all,
I have installed Solaris10 in a x86 machine.When the ls -l output is taken,at the Month's place some junk characters appear.Rest everything is fine. Cna somebody help..?
thanks
:b: (7 Replies)