Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command

652655Jun 29 2009 — edited Jul 7 2009
Hi All,

We've an email procedure with the code below. It sends emails successfully within the organization but not to emails outside the organization e.g. test@yahoo.com or myaddress@university.edu.uk the procedure always returns the following error: ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command
create or replace PROCEDURE CUST_MAIL(pToAddress varchar2,
                                        pSubject   VARCHAR2,
                                        pMessage   varchar2) IS
  gMailHost  VARCHAR2(30) := 'mail.jtech.co.uk';
  gMailConn  utl_smtp.connection;
  gMailReply utl_smtp.reply;
  gBuffer    VARCHAR2(32767);
BEGIN
  EXECUTE IMMEDIATE 'ALTER SESSION SET TIME_ZONE = ''GMT''';
  gMailConn  := utl_smtp.open_connection(gMailHost, 25);
  gMailReply := utl_smtp.helo(gMailConn, gMailHost);
  gMailReply := utl_smtp.mail(gMailConn, 'info@jtech.co.uk');
  gMailReply := utl_smtp.rcpt(gMailConn, pToAddress);
  gMailReply := utl_smtp.open_data(gMailConn);

  -- Build From
  gBuffer := 'From: Customer Desk';
  utl_smtp.write_data(gMailConn, gBuffer || chr(13) || chr(10));

  -- Build To
  gBuffer := 'To: ' || pToAddress;
  utl_smtp.write_data(gMailConn, gBuffer || chr(13) || chr(10));

  -- Build Subject
  gBuffer := 'Subject: ' || pSubject;
  utl_smtp.write_data(gMailConn, gBuffer || chr(13) || chr(10));

  -- Build Date
  gBuffer := 'Date: ' ||
             TO_CHAR(current_timestamp, 'DY, DD-MON-YYYY HH24:MI:SS');
  utl_smtp.write_data(gMailConn, gBuffer || chr(13) || chr(10));

  -- Build Message-ID
  gBuffer := 'Message-ID: ' ||
             TO_CHAR(current_timestamp, 'YYYYMMDDHH24MISS.FF') ||
             '.info.jtech.co.uk';
  utl_smtp.write_data(gMailConn, gBuffer || chr(13) || chr(10));

  -- Add another carriage return before the message
  utl_smtp.write_data(gMailConn, chr(13) || chr(10) || UTL_TCP.CRLF);
  utl_smtp.write_data(gMailConn, pMessage || chr(10) || chr(13));

  -- The end
  gMailReply := utl_smtp.close_data(gMailConn);
  utl_smtp.quit(gMailConn);
END;
Your guidance will be highly appreciated.

Kind regards
Mel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2009
Added on Jun 29 2009
2 comments
1,820 views