Email issue

hi all,

i am not getting with the email attached not sure what wrong with the syntax can u help me out plz.

cat notavailabltext.txt
please reach to team for any issues.

uuencode notavailable.txt notavailable.txt | mailx -m -s "Files are available" arun@trival.com < notavailabltext.txt

Hello arun888,

You can use following.

 cat Input_file | uuencode Input_file | mailx -s"test" ravinder.singh@chumma.com
 

Make sure you have uuencode command in your box.

Thanks,
R. Singh

1 Like

hi ravi,

I am using hp unix.

My requirement is i need to attach a file and body of the email also need to be triggered.

could you please provide the syntax again.

---------- Post updated at 07:38 AM ---------- Previous update was at 07:36 AM ----------

cat notavail.txt | uuencode notavailable.txt notavailable.txt | mailx -m -s "Files are not available"  test@sample.com

I have tried the above syntax

Hi,

you feed notavail.txt to uuencode and then feed uuencodes output too mailx. You do not see any email body because only the encoded content of your textfile arrives at mailx. For a mail body use something like this:

( cat notavail.txt ; uuencode notavailable.txt notavailable.txt ) | mailx -m -s "Files are not available"  test@sample.com
1 Like

hi cero,

Your syntax worked as i expected.

Currently one problem i am facing is. the format looks different in unix end and format looks in different in notepad as well.currently the file is appending in the same line. could you please let me know if it is need to be appended in the next line what needs to be done.

current syntaxt:

echo "$i" >>available.txt
else
echo "$i" >>notavailable.txt
fi

Please let me know how to change the syntax to be appended in the new line.

---------- Post updated at 12:43 AM ---------- Previous update was at 12:29 AM ----------

in the unix side the format is like the lines are printing in the second line.
whereas in the attachment. it looks like all the lines are printed in the same line.
Expected output is in notepad it should like the lines are printed in the next line.

There are different line terminators in the unix and the windows world. To add the line endings windows editors understand there are 2 ways:
Create the text with the needed endings:

printf "First line\r\n" >>available.txt
printf "Second line\r\n" >>available.txt

Convert the line endings: if the tool unix2dos is availabe it is the easiest and most self descriptive way. If it's not installed tools like sed can be used (there may be better/more elegant ways than below - you'll find lots of examples when you search this site):

sed -e 's/$/\r/' notavailable.txt
1 Like

Hi Cero,

Thanks for your help.