Вы заявляете Content-type:text/html;charset=iso-8859-1
. ISO-8859-1 не поддерживает китайские символы, поэтому они не отображаются.
Я бы порекомендовал эту процедуру:
PROCEDURE SendMail(
Subject IN VARCHAR2,
Message IN OUT CLOB,
ToMail IN VARCHAR2,
FromMail IN VARCHAR2,
FromName IN VARCHAR2,
PRIORITY IN INTEGER DEFAULT 3) IS
PRIORITY_HIGH CONSTANT INTEGER := 1;
PRIORITY_NORMAL CONSTANT INTEGER := 3;
PRIORITY_LOW CONSTANT INTEGER := 5;
MIME_HTML CONSTANT VARCHAR2(50) := 'text/html;';
SMTP_PORT CONSTANT INTEGER := 25;
SMTP_SERVER CONSTANT VARCHAR2(50):= 'mailhost';
con UTL_SMTP.CONNECTION;
ret UTL_SMTP.REPLY;
Charset VARCHAR2(20);
LobLen INTEGER;
amount INTEGER := 8000;
BUFFER VARCHAR2(32000);
OFFSET INTEGER := 1;
BEGIN
-- setup mail header
con := UTL_SMTP.OPEN_CONNECTION(SMTP_SERVER, SMTP_PORT);
ret := UTL_SMTP.HELO(con, SYS_CONTEXT('USERENV', 'DB_DOMAIN'));
ret := UTL_SMTP.MAIL(con, FromMail);
ret := UTL_SMTP.RCPT(con, ToMail);
ret := UTL_SMTP.OPEN_DATA(con);
IF CONVERT(FromName, 'US7ASCII') = FromName THEN
UTL_SMTP.WRITE_DATA(con, 'From: "'||FromName||'" <'||FromMail||'>'||UTL_TCP.CRLF);
ELSE
UTL_SMTP.WRITE_DATA(con, 'From: =?UTF-8?B?'|| UTL_ENCODE.TEXT_ENCODE(FromName, 'AL32UTF8', UTL_ENCODE.BASE64) ||'?= <'||FromMail||'>'||UTL_TCP.CRLF);
END IF;
UTL_SMTP.WRITE_DATA(con, 'To: '||ToMail||UTL_TCP.CRLF);
IF CONVERT(Subject, 'US7ASCII') = Subject THEN
UTL_SMTP.WRITE_DATA(con, 'Subject: '||Subject||UTL_TCP.CRLF);
ELSE
UTL_SMTP.WRITE_DATA(con, 'Subject: =?UTF-8?B?'|| REPLACE(REPLACE(UTL_ENCODE.TEXT_ENCODE(Subject, 'AL32UTF8', UTL_ENCODE.BASE64), CHR(13), NULL), CHR(10), NULL) ||'?='||UTL_TCP.CRLF);
END IF;
UTL_SMTP.WRITE_DATA(con, 'Date: '||TO_CHAR(CURRENT_TIMESTAMP, 'Dy, DD Mon YYYY hh24:mi:ss TZHTZM', 'NLS_DATE_LANGUAGE = American')||UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(con, 'X-Priority: '||PRIORITY||UTL_TCP.CRLF);
SELECT UTL_I18N.MAP_CHARSET(VALUE)
INTO Charset
FROM NLS_DATABASE_PARAMETERS
WHERE parameter = 'NLS_CHARACTERSET';
UTL_SMTP.WRITE_DATA(con, 'Content-type: '||MIME_HTML||' charset='||Charset || UTL_TCP.CRLF);
-- Mail Body
UTL_SMTP.WRITE_DATA(con, UTL_TCP.CRLF);
LobLen := DBMS_LOB.GETLENGTH(Message);
LOOP
EXIT WHEN OFFSET > LobLen;
DBMS_LOB.READ(Message, amount, OFFSET, BUFFER);
UTL_SMTP.WRITE_RAW_DATA(con, UTL_RAW.CAST_TO_RAW(BUFFER));
OFFSET := OFFSET + amount;
END LOOP;
UTL_SMTP.WRITE_DATA(con, UTL_TCP.CRLF);
-- finish mail
ret := UTL_SMTP.CLOSE_DATA(con);
ret := UTL_SMTP.QUIT(con);
EXCEPTION
WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
UTL_SMTP.QUIT(con);
END SendMail;