Sending Mails using UTL_SMTP with Microsoft Exchange Server 2007
I am trying to send emails using out mail host Microsoft Exchange 2007. When I send the mail to other domains with out authentication them I am getting an error
ERROR at line 1:
ORA-29279: SMTP permanent error: 550 5.7.1 Unable to relay
ORA-06512: at "SYS.UTL_SMTP", line 20
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 240
ORA-06512: at line 9
If I use authentication as below
Declare
l_mailhost VARCHAR2 (255) := '<mail host>';
l_mail_conn UTL_SMTP.connection;
BEGIN
l_mail_conn := UTL_SMTP.open_connection (l_mailhost, '<Port Number>');
UTL_SMTP.helo (l_mail_conn, l_mailhost);
utl_smtp.command( l_mail_conn, 'AUTH LOGIN');
utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( '<User Name>' ))) );
utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( '<Password>' ))) );
UTL_SMTP.mail (l_mail_conn, '<From User>');
UTL_SMTP.rcpt (l_mail_conn, '<To User>');
UTL_SMTP.open_data (l_mail_conn);
utl_smtp.write_data(l_mail_conn, 'Subject: Your Subject Line Here');
UTL_SMTP.write_data (l_mail_conn, 'This is a test mail.........');
UTL_SMTP.close_data (l_mail_conn);
UTL_SMTP.quit (l_mail_conn);
END;
I am getting the following error
Error at line 1
ORA-29279: SMTP permanent error: 504 5.7.4 Unrecognized authentication type
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 99
ORA-06512: at "SYS.UTL_SMTP", line 159
ORA-06512: at line 9
Script Terminated on line 1.
the reason could be, my server does not support authentication type LOGIN. It supports GSSAPI NTLM.
Can anyone help me in using GSSAPI NTLM to authenticate the mail server.