Reputation: 310
I'm getting an ORA-29279 error when running the below snipped. Suggest me if some issue in this
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;
when I execute that procedure
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
don't know how to deal with this this is some kind of smtp setting ? all email address is valid
if some one have better solution then tell me I create these pocedure in plsql
Upvotes: 2
Views: 47079
Reputation: 1
Check your host. This is the host problem. Use the query.
SELECT UTL_INADDR.get_host_name,UTL_INADDR.get_host_address('your-server-address') FROM dual;
Upvotes: 0
Reputation: 6449
The result code from the SMTP server: 530 5.7.1 Client was not authenticated is telling you that you need to authenticate with the server. Specifically result code 530 indicates that you "must issue a STARTTLS command. Encryption required for requested authentication mechanism"
The STARTTLS
command further requires you to use an extended form of the call to OPEN_CONNECTION
passing in details of the Oracle wallet to use when securing the connection. You may also need to make a call the AUTH
function or procedure to fully authenticate your connection.
Please view the UTL_SMTP documentation for additional info.
Upvotes: 2