Send Emails from PL/SQL
来源:互联网 发布:淘宝店主页装修 编辑:程序博客网 时间:2024/06/06 07:09
1.要想从DB Server发邮件,首先得确保DB Server已经启用了SMTP(Simple Mail Transfer Protocol)服务。检查是否启动SMTP的方法
telnet server.domain.com 25
(25是SMTP的默认端口)
2.PL/SQL to send email sample code:
telnet server.domain.com 25
(25是SMTP的默认端口)
2.PL/SQL to send email sample code:
DECLARE lc_from_email_id VARCHAR2 (100); lc_mailhost VARCHAR2 (100) := 'abc.com'; lc_connection UTL_SMTP.connection; v_mail_sub VARCHAR2 (200) := 'Hello'; v_mail_body VARCHAR2 (1000) := 'This is the mail body'; v_from_email VARCHAR2 (100) := 'ptian@xxx.com'; v_to_email VARCHAR2 (100) := 'ptian@xxx.com';BEGIN lc_connection := UTL_SMTP.open_connection (lc_mailhost, 25); UTL_SMTP.helo (lc_connection, lc_mailhost); UTL_SMTP.mail (lc_connection, v_from_email); UTL_SMTP.rcpt (lc_connection, v_to_email); UTL_SMTP.open_data (lc_connection); UTL_SMTP.write_data (lc_connection, 'Subject' || ':' || v_mail_sub || ' ' || UTL_TCP.crlf); UTL_SMTP.write_data (lc_connection, UTL_TCP.crlf || v_mail_body || UTL_TCP.crlf); UTL_SMTP.close_data (lc_connection); UTL_SMTP.quit (lc_connection);EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line ('Mail not sent');END;
ps:可以通过下边的Query来获取SMTP Server Name
select fscpv.parameter_value smtp_server_namefrom fnd_svc_comp_params_tl fscpt, fnd_svc_comp_param_vals fscpv, fnd_svc_components fscwhere fscpt.parameter_id = fscpv.parameter_idand fscpv.component_id = fsc.component_idand fscpt.display_name = 'Outbound Server Name'and fsc.component_name = 'Workflow Notification Mailer';
- Send Emails from PL/SQL
- Send Emails from PL/SQL .
- ORACLE SEND MAIL WITH PL/SQL
- Performing SQL Operations from PL/SQL
- Using VBScript to Send Emails with Gmail
- Duplicate Emails Leetcode SQL
- SQL-Duplicate Emails
- SQL-Delete Duplicate Emails
- Beginning PL/SQL: From Novice to Professional
- (转)FTP From PL/SQL
- pl/sql developer快速输入select * from
- pl/sql developer快速输入select * from
- pl/sql developer快速输入select * from
- [leetcode][SQL]182. Duplicate Emails
- sql leetcode 182. Duplicate Emails
- ORA-06502 assigning values from SQL to PL/SQL variables
- pl-sql中select * from dual 这个dual是什么
- PL/SQL如何快速打出select * from 记住登陆密码
- servlet 监听器
- C语言的布尔类型
- extern "C" 的用意
- Swinghacks——带搜索功能的JTextArea
- 【PHPExcel】常用方法汇总
- Send Emails from PL/SQL
- android 自带sax解析
- 用VC++实现USB接口读写数据的程序
- 立体匹配算法介绍
- Struts1和Struts2比较
- Signals框架介绍(三)原生事件
- WebKit内核源代码分析(五)
- 栈的顺序存储结构
- asp.net 获取网站根目录