html - 在 PL/SQL 中将电子邮件中的文本加粗
问题描述
在以电子邮件粗体发送之前,我试图在变量 var_sub_title 粗体中格式化文本。
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@mail.com',
p_from =>'email@email.net',
p_body => var_sub_title||CHR(10)||CHR(13)||var_txt||CHR(10)||CHR(13);
p_subj => var_msg_sub);
htmldb_mail.push_queue;
end;
我怎样才能归档这个?
解决方案
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 notp_body_html
results in a plain text message. Passing a value top_body
andp_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@mail.com',
p_from => 'email@email.net',
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
推荐阅读
- php - PHP / CSV 导出 - 空白行问题
- eclipse - 由于证书问题,无法在 Spring 工具套件中安装插件
- haproxy - 通过 haproxy 访问节点应用程序时出现 504 网关超时错误
- python - 在熊猫中将 datetimeindex 扩展到以前的时间
- java - 如何设置微调器初始文本“SELECT ONE”?
- android - 错误:已添加片段:GrowthStoryFragment
- centos - zabbix如何监控虚拟IP?
- laravel - Laravel 缓存路由文件访问,5.8 版
- azure-devops - 如何将自定义 Angular 库包添加到 Azure DevOps?
- html - CSS 图像大小。左边是文字,右边是图片