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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Send MailAI
- [原創]How to send patch files by git send-mailGitAI
- Send E-mail with PDF attachment using Node.jsAINode.js
- 【ASK_ORACLE】Oracle RAC報錯“ipc send timeout”的原因以及解決辦法Oracle
- XMLHttpRequest send()XMLHTTP
- You have new mail in /var/spool/mail/rootAI
- Others_2_MailAI
- nagios mail告警通知iOSAI
- 用ffsend使用Firefox SendFirefox
- golang mail、shell、cookie、uuidGolangAICookieUI
- Fedora 中如何使用 Firefox Send?Firefox
- 生成器yield,next()與send()
- 基於Spring Boot傳送 mailSpring BootAI
- Linux之郵件mail服務LinuxAI
- 2020-11-13 python和 mailPythonAI
- linux下mail的簡單用法LinuxAI
- linux 主機mail 系統配置.LinuxAI
- 在 Fedora 中利用 ffsend 使用 Firefox SendFirefox
- 【問題處理】IPC Send timeout detected
- 配置mail使用SMTP傳送郵件AI
- javax.mail.MessagingException:[EOF] 解決方法JavaAIException
- Zoho mail 多樣化的使用技巧AI
- Swoole 原始碼分析——Client模組之Send原始碼client
- 024 Rust死靈書之Send和SyncRust
- Linux基礎命令---mail郵件管理程式LinuxAI
- PostgreSQL mail list patch:Non-volatile WAL BUFFERSQLAI
- Springboot進階-JDBC、Druid、Mybatis、Swagger、SpringMVC、MailSpring BootJDBCUIMyBatisSwaggerSpringMVCAI
- Linux 如何啟動mail郵件服務LinuxAI
- [20221103]奇怪的mail資訊(整理版本).txtAI
- Rust中的併發性:Sync 和 Send TraitsRustAI
- win10 mail介面如何設定中文_win10 mail設為中文版怎麼設定Win10AI
- win10自帶mail怎麼解除安裝_win10自帶mail如何徹底解除安裝Win10AI
- Zoho Mail 2018全新改版,都有哪些新亮點?AI
- 如何在Apple Mail中設定外出答覆APPAI
- Java Mail 郵件傳送(一):入門DemoJavaAI
- Python生成器next方法和send方法區別Python
- 013 Rust 非同步程式設計,Send trait 相關Rust非同步程式設計AI
- os ,shutil,send2trash模組彙總(tcy)