×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Sending HTML formatted message into Outlook 2010

Sending HTML formatted message into Outlook 2010

Sending HTML formatted message into Outlook 2010

(OP)
Hi,

I am running a back end HPUX 11.11 DB server and producing a HTML file using sqlplus and sending this through mailx into Outlook 2010. My issue is that the email comes in as text and not in html format. Here are the scripts:

test.ksh

#!/bin/ksh
#set -x

# Filename :
# Author : Test
# Date : 14-Dec-2015
# Description : Reports
#

export DBNAME=$1
export TDATE=`date +%d%m%Y_%H%M%S `
export ORACLE_SID=prod
export ORACLE_HOME=`grep ${DBNAME}: /etc/oratab | awk -F: '{ print $2 }'` export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib
MAILLIST='test@xx.com'

##############################
# Run Reports #
##############################

sqlplus system/xxx@${DBNAME}<< SQLEOF
set feedback off echo off trimspool on sqlprompt ""
set serveroutput on size 1000000
spool /opt/app/oracle/admin/maint/dailychecks/html/Checks_${DBNAME}_${TDATE}.log
@/opt/app/oracle/admin/maint/dailychecks/test.sql
SQLEOF

##############################
# EMAIL Reports #
##############################

#/dev/null 2>&1

cat /opt/app/oracle/admin/maint/dailychecks/html/Checks_${DBNAME}_${TDATE}.log | tail +2 | mailx -s "Check Report for ${DBNAME}" ${MAILLIST} > /dev/null 2>&1

test.sql

DECLARE
v_date DATE;
v_bgcolour VARCHAR2(6);
v_subject VARCHAR2(150);
v_hostname VARCHAR2(30);
v_instance_name VARCHAR2(30);

BEGIN

select upper(host_name),upper(INSTANCE_NAME) into v_hostname, v_instance_name
from
v$instance;

select trunc(sysdate) into v_date from dual;

DBMS_OUTPUT.PUT_LINE('<!DOCTYPE html>');
DBMS_OUTPUT.PUT_LINE('<html>');
DBMS_OUTPUT.PUT_LINE('<head>');
DBMS_OUTPUT.PUT_LINE('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');

-- DBMS_OUTPUT.PUT_LINE('MIME-Version: 1.0');
-- DBMS_OUTPUT.PUT_LINE('From: Test');
-- DBMS_OUTPUT.PUT_LINE('From: Test <xx@test.com> Reply-To: xx@test.com');
-- DBMS_OUTPUT.PUT_LINE('To: xx@test.com');
-- DBMS_OUTPUT.PUT_LINE('Subject: Checks for '||v_hostname);
-- DBMS_OUTPUT.PUT_LINE('Content-Type: text/html; charset=UTF-8;');
-- DBMS_OUTPUT.PUT_LINE('<html>');
DBMS_OUTPUT.PUT_LINE('<FONT face=arial,times>');
DBMS_OUTPUT.PUT_LINE('<title>');
DBMS_OUTPUT.PUT_LINE('DDC Daily Checks for '||v_hostname||' '||v_instance_name||' '||v_date);
DBMS_OUTPUT.PUT_LINE('</title>');
DBMS_OUTPUT.PUT_LINE('</head>');
DBMS_OUTPUT.PUT_LINE('<body BGCOLOR=99CCFF>');
DBMS_OUTPUT.PUT_LINE('<h1 align="center"><u>'||v_hostname||': '||v_instance_name||'</u></h1>');
DBMS_OUTPUT.PUT_LINE('<h2>REPORT</h2>');
DBMS_OUTPUT.PUT_LINE('</body>');
DBMS_OUTPUT.PUT_LINE('</html>');

END;
/

I've tried a few different headers but cant find the right syntax...

Thanks in advance.

RE: Sending HTML formatted message into Outlook 2010

(OP)
This is what comes in Outlook:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <FONT face=arial,times> <title> DDC Daily Checks for IRA03022 PROD 16-FEB-16 </title> </head> <body BGCOLOR=99CCFF>
<h1 align="center"><u>IRA03022: PROD</u></h1> <h2>REPORT</h2> </body> </html>

RE: Sending HTML formatted message into Outlook 2010

As far as I know mailx can't send in html format.
Is it an option to send the file as an attachment (-a option of mailx) ?
For that rename it from *.log to *.html.

Or try sendmail instead.

regards

RE: Sending HTML formatted message into Outlook 2010

(OP)
Thanks, sendmail isn't installed on the server I don't think but from another server, 'mail' works fine, that does send HTML emails.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close