数据库备份完成后,我需要在 Oracle APEX 中发送一封自动电子邮件。有什么方法可以确保数据库备份过程完成?
问问题
2074 次
1 回答
2
如果 DB Backup 是通过类似Submit
按钮的操作启动的,我们可以调用 a通过新进程PL/SQL Script
发送电子邮件。After Submit
以下是用于发送电子邮件的 APEX 方法:
apex_mail.send(
p_to => to_list, -- change to your email address
p_from => sender, -- change to a real senders email address
p_bcc => bcc_list,
p_body => l_body,
p_body_html => l_body_html,
p_subj => subject);
导航:
Page Definition -> Page Processing -> Processes
以下是在 SQL Workshop 中创建的用于发送电子邮件的示例 PL/SQL 函数:
create or replace function sendemail(sender in varchar2, receiver in varchar2, subject in varchar2, content in CLOB, signature in varchar2) return boolean is
sent_status boolean := false;
l_body clob;
l_body_html clob;
begin
l_body := 'To view the content of this message, please use an HTML enabled mail client.'||utl_tcp.crlf;
l_body_html := '<html>
<head>
<style type="text/css">
body{font-family: Arial, Helvetica, sans-serif;
font-size:10pt;
margin:30px;
background-color:#ffffff;}
span.sig{font-style:italic;
font-weight:bold;
color:#811919;}
</style>
</head>
<body>'||utl_tcp.crlf;
l_body_html := l_body_html ||content || utl_tcp.crlf;
l_body_html := l_body_html ||' <span class="sig">'||signature||'</span><br />'||utl_tcp.crlf;
l_body_html := l_body_html ||'</body></html>';
apex_mail.send(
p_to => receiver, -- change to your email address
p_from => sender, -- change to a real senders email address
p_bcc => sender,
p_body => l_body,
p_body_html => l_body_html,
p_subj => subject);
sent_status := true;
return sent_status;
end;
于 2015-08-24T07:51:48.247 回答