As documentation says, you need to pass your HTML-formatted text to parameter p_body_html
, not p_body
:
Plain text and HTML e-mail content. Passing a value to p_body
, but not p_body_html
results in a plain text message. Passing a value to p_body
and p_body_html
yields a multi-part message that includes both plain text and HTML content.
So your code should be:
declare
var_sub_title varchar2(60);
var_txt varchar2(500);
var_msg_sub varchar2(60);
begin
select sub_title, txt, subject into var_sub_title, var_txt, var_msg_sub from table where msg_id = :id;
-- SEND EMAIL --
HTMLDB_MAIL.SEND(
P_to => '[email protected]',
p_from => '[email protected]',
p_body_html => '<b>'|| var_sub_title || '</b>' || CHR(10) || CHR(13) || var_txt || CHR(10) || CHR(13);
p_subj => var_msg_sub);
htmldb_mail.push_queue;
end;
Also there are other restrictions on length and ability to process HTML emails by recipient's email client.
When using HTMLDB_MAIL.SEND, remember the following:
- No single line may exceed 1000 characters. The SMTP/MIME specification dictates that no single line shall exceed 1000 characters. To comply with this restriction, you must add a carriage return or line feed characters to break up your p_body or p_body_html parameters into chunks of 1000 characters or less. Failing to do so will result in erroneous e-mail messages, including partial messages or messages with extraneous exclamation points.
- Plain text and HTML e-mail content. Passing a value to p_body, but not p_body_html results in a plain text message. Passing a value to p_body and p_body_html yields a multi-part message that includes both plain text and HTML content. The settings and capabilities of the recipient's email client determine what displays. Although most modern e-mail clients can read a HTML formatted email, remember that some users disable this functionality to address security issues.
- Avoid images. When referencing images in p_body_html using the tag, remember that the images must be accessible to the recipient's e-mail client in order for them to see the image
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…