oracle send mail
oracle send mail
create or replace PROCEDURE p_send_mail
(
sender IN VARCHAR2,
recipient IN VARCHAR2,
ccrecipient IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2 DEFAULT NULL
) IS
crlf VARCHAR2(2):= UTL_TCP.CRLF;
connection utl_smtp.connection;
mailhost VARCHAR2(30):= 'Smtp-out-03.idc.com';
header VARCHAR2(1000);
BEGIN
-- Start the connection.
connection := utl_smtp.open_connection(mailhost,25);
header:= 'Date: '||TO_CHAR(SYSDATE,'dd Mon yy hh24:mi:ss')||crlf||
'From: '||sender||''||crlf||
'Subject: '||subject ||''||crlf||
'To: '||recipient||crlf||
'CC: '||ccrecipient;
-- Handshake with the SMTP server
utl_smtp.helo(connection, mailhost);
utl_smtp.mail(connection, sender);
utl_smtp.rcpt(connection, recipient);
utl_smtp.rcpt(connection, ccrecipient);
utl_smtp.open_data(connection);
-- Write the header
utl_smtp.write_data(connection, header);
utl_smtp.write_data(connection, crlf ||message);
utl_smtp.close_data(connection);
utl_smtp.quit(connection);
EXCEPTION
WHEN UTL_SMTP.INVALID_OPERATION THEN
dbms_output.put_line(' Invalid Operation in SMTP transaction.');
WHEN UTL_SMTP.TRANSIENT_ERROR THEN
dbms_output.put_line(' Temporary problems with sending email - try again
later.');
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Errors in code for SMTP transaction.');
END;
create or replace PROCEDURE p_send_mail
(
sender IN VARCHAR2,
recipient IN VARCHAR2,
ccrecipient IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2 DEFAULT NULL
) IS
crlf VARCHAR2(2):= UTL_TCP.CRLF;
connection utl_smtp.connection;
mailhost VARCHAR2(30):= 'Smtp-out-03.idc.com';
header VARCHAR2(1000);
BEGIN
-- Start the connection.
connection := utl_smtp.open_connection(mailhost,25);
header:= 'Date: '||TO_CHAR(SYSDATE,'dd Mon yy hh24:mi:ss')||crlf||
'From: '||sender||''||crlf||
'Subject: '||subject ||''||crlf||
'To: '||recipient||crlf||
'CC: '||ccrecipient;
-- Handshake with the SMTP server
utl_smtp.helo(connection, mailhost);
utl_smtp.mail(connection, sender);
utl_smtp.rcpt(connection, recipient);
utl_smtp.rcpt(connection, ccrecipient);
utl_smtp.open_data(connection);
-- Write the header
utl_smtp.write_data(connection, header);
utl_smtp.write_data(connection, crlf ||message);
utl_smtp.close_data(connection);
utl_smtp.quit(connection);
EXCEPTION
WHEN UTL_SMTP.INVALID_OPERATION THEN
dbms_output.put_line(' Invalid Operation in SMTP transaction.');
WHEN UTL_SMTP.TRANSIENT_ERROR THEN
dbms_output.put_line(' Temporary problems with sending email - try again
later.');
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Errors in code for SMTP transaction.');
END;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-242478/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Developer] Oracle send mail procedure(2)DeveloperOracleAI
- Send MailAI
- django send_mail功能DjangoAI
- [原創]How to send patch files by git send-mailGitAI
- mail can't send title on SolarisAI
- C# send mail with outlook and word mailmergeC#AI
- Send E-mail with PDF attachment using Node.jsAINode.js
- Oracle stored procedure to send emailOracleAI
- 資料庫包send_mail發郵件的配置含ACL和privilege資料庫AI
- 【Oracle】-PX Deq Credit: send blkdOracle
- oracle mail utl_smtpOracleAI
- 呼叫sp_send_mail時出現Msg 22050和Msg 14661錯誤AI
- XMLHttpRequest send()XMLHTTP
- 【Oracle】並行等待之PX Deq Credit: send blkdOracle並行
- mailAI
- You have new mail in /var/spool/mail/rootAI
- mail with attachmentAI
- Mail To SyntaxAI
- System.Net.Mail和System.Web.MailAIWeb
- [Shell] Monitor other host oracle instance alert.log and mailOracleAI
- Oracle UTL_MAIL郵件包程式使用實踐OracleAI
- IPC send completion sync
- IPC Send timeout detected
- ORACLE 9I RAC IPC Send timeout detected問題處理Oracle
- 9.Monitor other host oracle instance alert.log and mailOracleAI
- ORACLE mail傳送功能,增加使用者驗證功能OracleAI
- [Shell] 自動生成oracle awr report並mail出來OracleAI
- 利用ORACLE utl_stmp 包實現 mail傳送功能OracleAI
- 【ASK_ORACLE】Oracle RAC報錯“ipc send timeout”的原因以及解決辦法Oracle
- [Linux] mutt mail oracle awr [Html能正常顯示錶格]LinuxAIOracleHTML
- 用ffsend使用Firefox SendFirefox
- Others_2_MailAI
- 6.12.MailAI
- drupal7 mailAI
- awr 自動mailAI
- utl_mail packageAIPackage
- 163mailAI
- centos 老出現You have new mail in /var/spool/mail/root 解決CentOSAI