Is it possible to select and display the database table in classic report
manner in mail body while sending the mail in oracle APEX 4.2
?
Version : oracle APEX 4.2
SAMPLE : SAMPLE FORMAT FOR EMAIL
Regards, DOC
Yes you can, by sending an HTML email - but you have to construct the HTML yourself. For example:
declare
l_body_text long;
l_body_html long;
begin
l_body_html := '<table style="border-collapse: collapse; border: 1px solid black"><tbody>'
|| '<tr>'
|| '<th style="background-color: #eef; border: 1px solid black">ENAME</th>'
|| '<th style="background-color: #eef; border: 1px solid black">DNAME</th></tr>';
for r in (select ename, dname from emp)
loop
l_body_html := l_body_html || '<tr><td style="border: 1px solid black">'
|| r.ename || '</td><td style="border: 1px solid black">'
|| r.dname|| '</td></tr>';
end loop;
l_body_html := l_body_html || '</tbody></table>';
l_body_text := 'Plain text version';
apex_mail.send
( p_to => 'you@there.com'
, p_from => 'me@here.com'
, p_body => l_body_text
, p_body_html => l_body_html
, p_subj => 'Your report'
);
end;
Note:
- You need to supply a plain text alternative in case the recipient cannot receive HTML emails.
- You need to apply any styling in-line - you cannot reference a CSS file.
来源:https://stackoverflow.com/questions/30324617/select-and-display-the-table-in-oracle-apex-mail-body