Html format not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Html format not working
# 1  
Old 09-06-2016
Html format not working

Hi All,

I have a written a script which sents the output in html format and displays it in the foreground. But for some reason it is displaying in raw html format in outlook 2013. What could be the reason. I am pasting the script as below:-

Code:
[dba@server_1 scripts]$ cat script.sh
#!/bin/bash
. /home/dba/.bash_profile

cd /u01/session
rm created_objects.html



for DB in database_1
do

    export ORACLE_SID=$DB
    export ORACLE_HOME=`grep $DB /etc/oratab | awk -F ":" {'print$2'}`

    $ORACLE_HOME/bin/sqlplus -s "/ as sysdba" << EOF
    set markup html on spool on
    spool /u01/session/created_objects.html
    set linesize 200
    col machine for a45
    col username for a15
    col program for a35
    set feedback off
    set head on


    SELECT count(1) AS connection_count, machine, username, osuser, program
    FROM v\$session
    WHERE type <> 'BACKGROUND'
    GROUP BY username, machine,  osuser, program
    ORDER BY connection_count DESC;


    spool off;

    EOF

done

echo >> created_objects.html

mail -s "$(echo -e "Newly Created Objects\nContent-Type: text/html")" email@mail.com < /u01/session/created_objects.html


Moderator's Comments:
Mod Comment Use code tags, thanks.
# 2  
Old 09-06-2016
You don't say what system you are using. If you are using Linux I suggest you look at using mailx. The Gnu version should include MIME support and may be able to work with few modifications to your script.

You say that Outlook is displaying raw html. What about other clients?

Andrew
# 3  
Old 09-07-2016
try with sendmail

Code:
(
echo "To: me@example.com"
echo "Subject: hello"
echo "Content-Type: text/html"
echo
cat /u01/session/created_objects.html
echo
) | /usr/sbin/sendmail -t

This User Gave Thanks to itkamaraj For This Post:
# 4  
Old 09-07-2016
Hi Andrew,

I checked with other clients like yahoo and it is working fine. Only in outlook 2013 it is displaying as raw html. Linux version is as below:-

Linux server 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

---------- Post updated at 04:02 AM ---------- Previous update was at 03:56 AM ----------

Hi itkamaraj,

Thanks a lot. The piece of code which you shared is working. What could be the reason mail -s is not displaying in outlook 2013 in html format?

In other clients like yahoo, it is displaying in html format.
# 5  
Old 09-07-2016
Web based email can't really avoid showing text as HTML. What else is an HTML parser going to do when HTML is jammed into it by whatever means?

I suspect jamming 'content type' into the subject doesn't actually create a valid content-type header. Assembling a valid email and giving it to your mail daemon raw is better for picky things.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Disk Space Utilization in HTML format working in one environment and not working on the other

Hi Team, I have written the shell script which returns the result of the disk space filesystems which has crossed the threshold limit in HTML Format. Below mentioned is the script which worked perfectly on QA system. df -h | awk -v host=`hostname` ' BEGIN { print "<table border="4"... (13 Replies)
Discussion started by: Harihsun
13 Replies

2. Shell Programming and Scripting

Convert csv data to html format

I am new to html and need to convert the attached csv file data to html format ; running into issues. please assist. #!/bin/ksh echo "<html>" ; echo "<head><style> table {border-collapse: collapse;} table, td, th {border: 1px solid black;} </style></head>" echo "<title> REPORT </title>" echo... (0 Replies)
Discussion started by: archana25
0 Replies

3. Shell Programming and Scripting

Converting csv to html format

Below is the code I have - How can I convert the data in the csv into 3 tables in html. instead of 1 table. Attached is the format I am getting. (1 Reply)
Discussion started by: archana25
1 Replies

4. Shell Programming and Scripting

Format text file to html

Hi Experts, Anybody out there figure out on how to achieve in shell scripts or tools. I have done googling to find solutions but no luck. I have thousands of .txt files to batch process, please see the below sample text content after -------- start here --------. What I want to achieve is to... (10 Replies)
Discussion started by: lxdorney
10 Replies

5. Shell Programming and Scripting

Html output in correct format

Hi, I am running two scripts as below. In Script 1 i am getting correct output in proper HTML format while in script 2 i am not getting output in mail and only html code is getting printed.I want to get the output of script 2. Please guide. 1.IFILE=/home/home01/Report.csv if #Checks... (7 Replies)
Discussion started by: Vivekit82
7 Replies

6. Shell Programming and Scripting

removing html format with sed

Hello i am trying to remove the html format from the file using sed. for example remove <p> </p> i tried to do this : sed -e 's/<*>//g' test > test.t but still i have some html format . please help if you have any suggestions lets say this is the html file 1... (11 Replies)
Discussion started by: koricha
11 Replies

7. UNIX for Dummies Questions & Answers

How would i mail in html format?(Formatting Help)

I have written a scripts that checks the load average of server and if it is more than 5 it send a mail describing Current Load Average and High CPU/RAM processes . The problem is I want to send these information in html form .I have done necessary coding to do the same but whenever i try to... (7 Replies)
Discussion started by: pinga123
7 Replies

8. UNIX for Dummies Questions & Answers

How would i mail in html format?(Formatting Help)

I have written a scripts that checks the load average of server and if it is more than 5 it send a mail describing Current Load Average and High CPU/RAM processes . The problem is I want to send these information in html form .I have done necessary coding to do the same but whenever i try to... (0 Replies)
Discussion started by: pinga123
0 Replies

9. UNIX for Advanced & Expert Users

How to send email as HTML format with attachment ?

hi.. Could somebody help me how to sent an attachment using sendmail command and the content is HTML format ?. Below is my code to sent the email as HTML but i do not know how to sent the attachment, please help me To: "BAHARIN HASAN"<baharin.hasan@gmail.com> from: "DATAONE SDN... (4 Replies)
Discussion started by: bh_hensem
4 Replies

10. Shell Programming and Scripting

Displaying file in html loses format

I have a bash script to output the contents of a text file to html. Everything outputs ok, except this: ###################################################################### # # # PRIVATE/PROPRIETARY # # # # ANY UNAUTHORIZED ACCESS TO, OR MISUSE OF ABC COMPANY # # SYSTEMS OR DATA MAY... (2 Replies)
Discussion started by: numele
2 Replies
Login or Register to Ask a Question