運行下面的剪切時,我得到一個ORA-29279錯誤。建議我如果在這個如何解決發送郵件:ORA-29279 SMTP問題
CREATE OR REPLACE PROCEDURE CPO.fsc_temp_MAIL (l_from IN VARCHAR2,
l_to IN VARCHAR2,
Subject IN VARCHAR2,
Mesg IN VARCHAR2,
Cc IN VARCHAR2 default null,
P_Html BOOLEAN := FALSE) IS
l_to1 VARCHAR2(32000) := l_to;
Mhost VARCHAR2(64) := '192.168.0.6';
crlf varchar2(2) := CHR(13) || CHR(10);
conn UTL_SMTP.connection;
Address varchar2(32700);
BEGIN
conn := UTL_SMTP.open_connection(Mhost,25);
UTL_SMTP.helo(conn, Mhost);
UTL_SMTP.mail(conn, l_from);
GET_TEMP_INFO_MAIL(conn,l_to1);
If Cc is not null then
GET_TEMP_INFO_MAIL(conn,Cc);
end if;
IF P_Html THEN
Address := 'Date: ' || TO_CHAR(SYSDATE, 'DD MON RRRR HH24:MI:SS') ||
crlf ||'From: ' || l_from ||
crlf ||'To: ' || l_to ||
crlf ||'Cc: ' || Cc ||
crlf ||'Subject: ' || Subject || crlf
|| 'Content-Type: text/html; charset=us-ascii' || crlf
|| 'Content-Transfer-Encoding: 7bit' || crlf
|| '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' || crlf
|| '<html>' || crlf
|| '<head>' || crlf
|| '<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">' || crlf
|| '<title>' || subject || '</title>' || crlf
|| '</head>' || crlf
|| '<body>' || crlf|| utl_tcp.crlf
|| mesg || crlf
|| '</body></html>';
ELSE
Address := 'Date: ' || TO_CHAR(SYSDATE, 'DD MON RRRR HH24:MI:SS') ||
crlf ||'From: ' || l_from ||
crlf ||'To: ' || l_to ||
crlf ||'Cc: ' || Cc ||
crlf ||'Subject: ' || Subject ||
crlf || utl_tcp.crlf || mesg;
END IF;
UTL_SMTP.data(conn, Address);
UTL_SMTP.quit(conn);
EXCEPTION
WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;
一些問題,當我執行該程序
execute fsc_temp_MAIL('[email protected]','[email protected]','test for subject ','sdf','[email protected]',True);
ORA-29279: SMTP permanent error: 530 5.7.1 Client was not authenticated
不知道如何處理這 這是某種形式的SMTP設置 ? 所有的電子郵件地址是有效的
如果有一個人有更好的解決方案,然後告訴我,我在plsql中創建這些pocedure
與您要發送給的電子郵件地址無關。您的SMTP服務器需要驗證。閱讀[文檔](https://docs.oracle.com/cd/E18283_01/appdev.112/e16760/u_smtp.htm#BHAGEECF) – OldProgrammer
execute testing_email('[email protected]','mshakeel @ ctm .com.pk','[email protected]','測試主題','測試msg',message_status)你能告訴我什麼是消息狀態以及我爲消息狀態傳遞哪個值 –
這沒有什麼可做的與消息狀態。您的電子郵件服務器正在請求用戶名/密碼以便客戶端登錄。你的示例代碼沒有提供這個,這就是你得到錯誤的原因。請閱讀我發佈的文檔鏈接。 – OldProgrammer