This discussion is archived
6 Replies Latest reply: Dec 12, 2012 7:02 AM by Sudhir_Meru RSS

Not able to Send HTML Content in Apex Mail

Sudhir_Meru Newbie
Currently Being Moderated
Hi,

I am using Oracle Apex 4.2 and Oracle 11g XE

I am trying to add HTML content in the apex_send mail procedure. But it give me the below error.

>>•ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275


Below is the code i am trying to add in the apex_send mail


DECLARE
l_from varchar2(1000);
l_body CLOB;
l_body_html CLOB;

BEGIN
l_body := null;

l_body_html := '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta property="og:title" content="Seasons Greetings from sudhir Networks" />

<title>Seasons Greetings from sudhir Networks</title>
<style type="text/css">
/* Client-specific Styles */
#outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */
body{width:100% !important;} .ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */
body{-webkit-text-size-adjust:none;} /* Prevent Webkit platforms from changing default text sizes. */

/* Reset Styles */
body{margin:0; padding:0;}
img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
table td{border-collapse:collapse;}
#backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;}

body, #backgroundTable{
/*@editable*/ background-color:#FAFAFA;
}
#templateContainer{
/*@editable*/ border: 1px solid #DDDDDD;
}
h1, .h1{
/*@editable*/ color:#202020;
display:block;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:34px;
/*@editable*/ font-weight:bold;
/*@editable*/ line-height:100%;
margin-top:0;
margin-right:0;
margin-bottom:10px;
margin-left:0;
/*@editable*/ text-align:left;
}
h2, .h2{
/*@editable*/ color:#202020;
display:block;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:30px;
/*@editable*/ font-weight:bold;
/*@editable*/ line-height:100%;
margin-top:0;
margin-right:0;
margin-bottom:10px;
margin-left:0;
/*@editable*/ text-align:left;
}
h3, .h3{
/*@editable*/ color:#202020;
display:block;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:26px;
/*@editable*/ font-weight:bold;
/*@editable*/ line-height:100%;
margin-top:0;
margin-right:0;
margin-bottom:10px;
margin-left:0;
/*@editable*/ text-align:left;
}
h4, .h4{
/*@editable*/ color:#202020;
display:block;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:22px;
/*@editable*/ font-weight:bold;
/*@editable*/ line-height:100%;
margin-top:0;
margin-right:0;
margin-bottom:10px;
margin-left:0;
/*@editable*/ text-align:left;
}
#templatePreheader{
/*@editable*/ background-color:#FAFAFA;
}
.preheaderContent div{
/*@editable*/ color:#505050;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:10px;
/*@editable*/ line-height:100%;
/*@editable*/ text-align:left;
}
.preheaderContent div a:link, .preheaderContent div a:visited, /* Yahoo! Mail Override */ .preheaderContent div a .yshortcuts /* Yahoo! Mail Override */{
/*@editable*/ color:#336699;
/*@editable*/ font-weight:normal;
/*@editable*/ text-decoration:underline;
}
#templateHeader{
/*@editable*/ background-color:#FFFFFF;
/*@editable*/ border-bottom:0;
}
.headerContent{
/*@editable*/ color:#202020;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:34px;
/*@editable*/ font-weight:bold;
/*@editable*/ line-height:100%;
/*@editable*/ padding:0;
/*@editable*/ text-align:center;
/*@editable*/ vertical-align:middle;
}
.headerContent a:link, .headerContent a:visited, /* Yahoo! Mail Override */ .headerContent a .yshortcuts /* Yahoo! Mail Override */{
/*@editable*/ color:#336699;
/*@editable*/ font-weight:normal;
/*@editable*/ text-decoration:underline;
}

#headerImage{
height:auto;
max-width:600px;
}
#templateContainer, .bodyContent{
/*@editable*/ background-color:#FFFFFF;
}
.bodyContent div{
/*@editable*/ color:#505050;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:14px;
/*@editable*/ line-height:150%;
/*@editable*/ text-align:left;
}
.bodyContent div a:link, .bodyContent div a:visited, /* Yahoo! Mail Override */ .bodyContent div a .yshortcuts /* Yahoo! Mail Override */{
/*@editable*/ color:#336699;
/*@editable*/ font-weight:normal;
/*@editable*/ text-decoration:underline;
}

.bodyContent img{
display:inline;
height:auto;
}
#templateFooter{
/*@editable*/ background-color:#FFFFFF;
/*@editable*/ border-top:0;
}

.footerContent div{
/*@editable*/ color:#707070;
/*@editable*/ font-family:Arial;
/*@editable*/ font-size:12px;
/*@editable*/ line-height:125%;
/*@editable*/ text-align:left;
}
.footerContent div a:link, .footerContent div a:visited, /* Yahoo! Mail Override */ .footerContent div a .yshortcuts /* Yahoo! Mail Override */{
/*@editable*/ color:#336699;
/*@editable*/ font-weight:normal;
/*@editable*/ text-decoration:underline;
}

.footerContent img{
display:inline;
}

#social{
/*@editable*/ background-color:#FAFAFA;
/*@editable*/ border:0;
}

#social div{
/*@editable*/ text-align:center;
}

#utility{
/*@editable*/ background-color:#FFFFFF;
/*@editable*/ border:0;
}
#utility div{
/*@editable*/ text-align:center;
}

#monkeyRewards img{
max-width:190px;
}
</style>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<center>
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable">
<tr>
<td align="center" valign="top">

<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateContainer">
<tr>
<td align="center" valign="top">
<!-- // Begin Template Header \\ -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader">
<tr>
<td class="headerContent">
<img src="http://www.sudhirnetworks.com/i/logo/sudhir-logo.png" style="max-width:600px; padding-top: 20px;" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext />
</td>
</tr>
</table>
<!-- // End Template Header \\ -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- // Begin Template Body \\ -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody">
<tr>
<td valign="top" class="bodyContent">

<!-- // Begin Module: Standard Postcard Content \\ -->
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr mc:repeatable>
<td valign="top">
<img src="http://www1.sudhirnetworks.com/ecard/sudhir_holidaycard_clickhere.jpg" style="width:560px;" mc:label="postcard_image" mc:edit="postcard_image" mc:allowtext />
<div mc:edit="std_content00">
<strong>Custom Message</strong> goes here.


</div>
</td>
</tr>
</table>
<!-- // End Module: Standard Postcard Content \\ -->

</td>
</tr>
</table>
<!-- // End Template Body \\ -->
</td>
</tr>
</table>

</td>
</tr>
</table>
</center>
</body>
</html>
';

l_from := lower(:app_user) || lower('@sudhirnetworks.com');

apex_mail.send(
p_to => :P1_TO,
p_from => l_from,
p_body => l_body,
p_body_html => L_BODY_HTML,
p_subj => :P1_SUBJECT);

APEX_MAIL.PUSH_QUEUE;

END;


Please suggest me how to fix this issue.

Thanks
Sudhir

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points