Represent the data in table format as in mail content

hi all,

I want to Represent the data in table format in mail content

sample data should be like this...but i m trying to send this table to mail using unix command...hw do i do????even i echoed the table contents ...doesnt work.... help me

<table style="background-color:lightblue;">
<tr style="background-color:blue;color:white;">
<th>Component</th><th>Status</th>
</tr>
<tr>
<td>OBj MGR</td><td style="background-color:lightgreen;">Green</td>
</tr>
<tr>
<td>Broker</td><td style="background-color:Red;">Red</td>
</tr>
</table>
<div>
<table style="background-color:lightblue;">
<tr style="background-color:blue;color:white;">
<th>Component</th><th>Status</th>
</tr>
<tr>
<td>OBj MGR</td><td style="background-color:lightgreen;">Green</td>
</tr>
<tr>
<td>Broker</td><td style="background-color:Red;">Red</td>
</tr>
</table>
</div>
  1. add <div> </div>
  2. write to a file, example: report.html

As an attachment:

uuencode report.html report.html | /usr/bin/mailx -s 'Report' me@mycompany.com

I tried this.

 
HTML CONTENT:
<html>
<head> This is a test report </head>
<body> <p> Check this out. </p>
<div><table>
<th><td>col1</td><td>col2</td></th>
<tr><td>data</td><td>test</td></tr>
</table></div></body></html>

Added this to 1.html
Tried sending like this

 
uuencode 1.html 1.html | /bin/mailx -s "Test Report" myname@domain.com

All I received is like below

la;sfaui90712349klga; agadf'%&^$adakl;fjad 

Nothing understood (I intended to say unreadable contents in mail :slight_smile: )

Please reply

Some possible solutions in this thread...

@Ygor: Thanks for the link.

The requirement for is little different. Here it is

  1. I am using HP-UX
  2. I have only sendexchange, mailx and mail utilities to send mails
  3. I want to show the data not as an attachment but to be in the content of the mail.
  4. Mail Contents should be,
    [list=1]
  5. CONTENTS - Description of report
  6. TABLE
    [list=1]
  7. Header which will have column names
  8. Rows which holds the data
    [/list]

    [/list]

Any suggestions???

Hi: create a file.html and execute this code

DEST=address@dest.com
CC=address@cc.com
FROM="Sender"
SUBJECT="Subject"
BODY=`cat file.html`
cat << _MAIL_ | /usr/lib/sendmail -F "${FROM}" -f "${FROM}" "${DEST}"
Subject:${SUBJECT}
CC:$CC
Content-Type: text/html;
$BODY
_MAIL_

@franzpizzo: thanks. But the problem is there is no sendmail in my system.

I am not allowed to install any new utilities as well

NEW THREAD: http://www.unix.com/shell-programming-scripting/218385-common-issue-table-displayed-mail-content-not-attachment.html\#post302780843

sendmail is usually in /usr/sbin and not on the normal path

Hi You Can try the following.. Worked for me in sun solaris.

Create the html file then
add

########################################

# send the mail..
 
export SUB="Subject : $timestamp"
export FROM="xxxxxxxx@xxxx.com"
export TO="xxxxxxxx@xxxx.com"
export CC="xxxxxxxx@xxxx.com"
export CONTENT="$mail_path"
(
echo "Subject: $SUB"
echo "From:$FROM"
echo "MIME-Version: 1.0"
echo "To: $TO"
echo "Cc: $CC"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $CONTENT
) | /usr/sbin/sendmail -vt

##################################################

:b: