1

I have oracle function to format mail data before sending. Function is called by pl/sql process in apex. But i have small problem with css formating of mail. I want to have div with fixed width to 750px. And my table and other elements will fit to this specifed width. Problem is that when i define fixed width of div it does not work. I have tried it on jsfiddle and it works but it does not work in oracle function. When i define other div parameter as font size, color, border etc. it works. But i am not able to change width of div. This is my function:

 create or replace FUNCTION  "SEND_MAIL" RETURN varchar2
    AS
     PRAGMA AUTONOMOUS_TRANSACTION;
     kontr_tema varchar2(500);
     komentar varchar2(2000);
     obl varchar2 (100);
     riz varchar2 (1);
     riz_warning varchar2(100);
     last_report_id number;
     vystup varchar2(2601);

    begin

    select RIZIKO into riz from AUDIT_REPORTS
    where REPORT_ID =
    (select max(REPORT_ID) from AUDIT_REPORTS);

    select OBLAST into obl from AUDIT_REPORTS
    where REPORT_ID =
    (select max(REPORT_ID) from AUDIT_REPORTS);

    FOR x in(select OPIS_KONTROLY  from AUDIT_REPORTS
    where REPORT_ID =
    (select max(REPORT_ID) from AUDIT_REPORTS))
    loop
    komentar := ''||x.OPIS_KONTROLY||'<br />';
    end loop;

    FOR x1 in(select KONTROLNA_TEMA  from AUDIT_REPORTS
    where REPORT_ID =
    (select max(REPORT_ID) from AUDIT_REPORTS))
    loop
    kontr_tema := ''||x1.KONTROLNA_TEMA||'<br />';
    end loop;



    vystup := '
    <html>
    <head>

     <style type="text/css">
        div{
          position:relative;
          width:750px;
          border: 1px solid black;
          border-collapse: separate;
        }
        </style>

        <style type="text/css">
        "table,th,td" {
            border: 1px solid black;
            border-collapse: separate;
            width:100% !important;
        }
        </style>

    </head>    
    <body> 

     <div> 

     <table border = "1">

           <tr>
                <th>Oblasť</th>
                <th>Riziko</th>
                <th>Kontrolná téma</th>
                <th>Komentár</th>
             </tr>

             <tr>
                <td>'||obl||'</td>
                <td>'||riz||'</td>
                <td>'||kontr_tema||'</td>
                <td>'||komentar||'</td>
             </tr>      
     </table>   


         </div>

    </body> 
    </html> ';

    return vystup;
    commit;

     end;
OldProgrammer
  • 12,050
  • 4
  • 24
  • 45
john179
  • 25
  • 1
  • 12

1 Answers1

1

See this answer. The problem is not in Oracle or in APEX, it is that email clients often ignore CSS headers and you should avoid them and instead use inline styling e.g.

<div style="width: 750px">...</div>
Tony Andrews
  • 129,880
  • 21
  • 220
  • 259
  • i use outlook 2010. Inline styling does not help. When i specify other parameters of div as border, font-size, color etc it works. There is only problem with width parameter. – john179 Aug 22 '17 at 07:01