Dear All,
I'm trying to send mail WTH of below given proc, but I got
ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command
error, however I'm able to send mails WTH of a java program for the same mailhost
CREATE OR REPLACE PROCEDURE Send_Mail_Test
AS
l_mailhost VARCHAR2 (64) := 'smtp.gmail.com';
l_from VARCHAR2 (64) := 'abc@gmail.com';
l_to VARCHAR2 (64) := 'abc@gmail.com';
l_mail_conn UTL_SMTP.connection;
BEGIN
-- l_mail_conn := UTL_SMTP.open_connection (l_mailhost, 25);--(l_mailhost, 465);
l_mail_conn := UTL_SMTP.open_connection (l_mailhost, 587);
UTL_SMTP.helo (l_mail_conn, l_mailhost);
-- For Authenication
utl_smtp.command(l_mail_conn,'STARTTLS');
UTL_SMTP.command (l_mail_conn, 'AUTH LOGIN');
utl_smtp.command(l_mail_conn, utl_encode.base64_encode(utl_raw.cast_to_raw('abc@gmail.com')));
utl_smtp.command(l_mail_conn, utl_encode.base64_encode(utl_raw.cast_to_raw('mypassword')));
UTL_SMTP.mail (l_mail_conn, l_from);
UTL_SMTP.rcpt (l_mail_conn, l_to);
UTL_SMTP.open_data (l_mail_conn);
UTL_SMTP.write_data (l_mail_conn,
'Date: '
|| TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
|| UTL_TCP.crlf
);
UTL_SMTP.write_data (l_mail_conn, 'From: ' || l_from || UTL_TCP.crlf);
UTL_SMTP.write_data (l_mail_conn, 'Subject: ' || 'test' || UTL_TCP.crlf);
UTL_SMTP.write_data (l_mail_conn, 'To: ' || l_to || UTL_TCP.crlf);
UTL_SMTP.write_data(l_mail_conn, utl_tcp.CRLF);
UTL_SMTP.write_data (l_mail_conn, 'test');
UTL_SMTP.close_data (l_mail_conn);
UTL_SMTP.quit (l_mail_conn);
END Send_Mail_Test;
/
Pls suggest
Thanks
*009*