Send emails with UTL_SMTP, the display of Chinese characters should use write_raw_data (); in accordance with the instructions of the Oracle website, examples are as follows: Create or Replace Procedure Sendeas --Mailhost Varchar2 (30): = 'SMTP-SERVER.SOME-COMPANY.COM'; Mailhost varchar2 (30): = '10 .155. *. * '; - It is best to use the IP address of the mail server Sender varchar2 (30): =' me@some-company.com '; Recipient varcha2 (30): =' Someone@some-company.com '; conn utl_smtp.connection; mesghead varcha2 (500); Mesgbody varcha2 (2000);
BEGIN conn: = utl_smtp.open_connection (mailhost, 25); utl_smtp.helo (conn, mailhost); utl_smtp.mail (conn, sender); utl_smtp.rcpt (conn, recipient); utl_smtp.open_data (conn); mesghead: = 'Date:' || to_CHAR (Sysdate, 'DD MON YY HH24: MI: SS') || UTL_TCP.CRLF || 'from:' || sender || UTL_TCP.CRLF || 'Subject: Sending Mail from Budget Forewarn System '|| UTL_TCP.CRLF ||' TO: '|| Recipient || UTL_TCP.CRLF || UTL_TCP.CRLF ||' '|| UTL_TCP.CRLF; UTL_SMTP.WRITE_DATA (CONN, MESGHEAD); MESGBODY: =' Computer Department budget warning indicators (January): '|| UTL_TCP.CRLF ||' 1, Budget Execution Rate: '|| UTL_TCP.CRLF ||' 2, Subject Budget Implementation: '|| UTL_TCP.CRLF || '' || UTL_TCP.CRLF || "This message is sent to the system, do not reply! '|| UTL_TCP.CRLF;
UTL_SMTP.WRITE_RAW_DATA (CONN, UTL_RAW.CAST_TO_RAW (MESGBODY)); UTL_SMTP.CLOSE_DATA (CONN); UTL_SMTP.QUIT (CONN); -Exception --when Others Then - Handle The Errornd; / Abstract After the address and mail address are replaced, you can run, do not need to consider the settings of NLS_LANG, if you have any questions, keep the Oracle server NLS_LANG settings consistent with the client. Good luck!