Oracle stored procedure to send email
這是以前從網上看來的儲存過程(很抱歉沒記住原作者)。
在moto做專案時自己修改後測試了一下,真的好用,呵呵。可惜自己修改後的版本沒有保留下來。
[@more@]create or replace procedure ProcSendEmail(txt varchar2)IS
--sender's email address
SendorAddress Varchar2(30) := ;
--receiver 's email address
ReceiverAddress varchar2(30) := ;
--mail server's name or ip address
EmailServer varchar2(30) := '10.10.1.168';
Port number := 25;
conn UTL_SMTP.CONNECTION;
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
contentmsg VARCHAR2( 60 ) := 'hello';
mesg VARCHAR2( 4000 );
mesg_body varchar2(4000);
BEGIN
conn:= utl_smtp.open_connection( EmailServer, Port );
utl_smtp.helo( conn, EmailServer );
utl_smtp.mail( conn, SendorAddress);
utl_smtp.rcpt( conn, ReceiverAddress );
mesg:=
'Content-Type: text/plain; Charset=GB2312' || crlf ||
'Date:' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
'From:' || SendorAddress || crlf ||
'Subject: Sending Mail From Database' || crlf ||
'To: '|| ReceiverAddress || crlf ||
'Content-Type: text/plain; Charset=GB2312' || crlf ||
'' || crlf || txt || crlf ;
utl_smtp.data( conn, mesg );
utl_smtp.quit( conn );
END;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/207/viewspace-779161/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Send Email with Attachments from PL/SQL using Java Stored ProceduresAISQLJava
- How to rename an Oracle stored procedureOracle
- [Developer] Oracle send mail procedure(2)DeveloperOracleAI
- execute shell script from stored procedure
- stored procedure 收集session wait 資訊SessionAI
- stored procedure 收集session wait 資訊(轉)SessionAI
- Entity Framework Tutorial Basics(29):Stored Procedure in Entity FrameworkFramework
- OWI --用 stored procedure 收集session wait 資訊SessionAI
- Entity Framework 6.0 Tutorials(9):Stored Procedure MappingFrameworkAPP
- SQL error 2812: Could not find stored procedure.docSQLError
- Spring 呼叫 Stored Procedure 並獲取返回值Spring
- Orale的struct,array,cursor,stored procedure,function,package的用法例子StructFunctionPackage
- oracle send mailOracleAI
- Oracle Wrap ProcedureOracle
- Stored Procedure(儲存過程)編寫經驗和最佳化措施 (轉)儲存過程
- 用oracle發emailOracleAI
- Result Sets from Stored Procedures In Oracle (轉)Oracle
- 【Oracle】-PX Deq Credit: send blkdOracle
- oracle 中呼叫 store procedureOracle
- NAVICATE 修改儲存過程提示PROCEDURE _Navicat_Temp_Stored_Proc already exists 解決方法儲存過程
- oracle儲存提綱(stored outline)Oracle
- Building a Dynamic Oracle ETL ProcedureUIOracle
- Calling Dbms_metadata.Get_ddl From Stored Procedure Results Ora-31603_463483.1
- 編寫電子書包平臺所有表主鍵之儲存過程_sp_stored procedure儲存過程
- 儲存過程plsql_stored procedure_為業務系統所有業務表生成主鍵pk方式儲存過程SQL
- Oracle之procedure的基礎使用Oracle
- [Developer] Oracle sendmail procedure(1)(轉載)DeveloperOracleAI
- Oracle Display the process of the procedure ( oracle pipe , dbms_output , prompt )Oracle
- [Procedure]Oracle之分頁儲存過程Oracle儲存過程
- 用Oracle傳送郵件procedure (zt)Oracle
- Oracle 基礎 ----procedure(儲存過程)Oracle儲存過程
- Send MailAI
- XMLHttpRequest send()XMLHTTP
- How Views are Stored (175)View
- 【Oracle】並行等待之PX Deq Credit: send blkdOracle並行
- [原創]How to send patch files by git send-mailGitAI
- 使用oracle job定時傳送email郵件OracleAI
- Oracle 使用者許可權獲取ProcedureOracle