0

I am trying to trigger email from PlSql using SMTP server and getting this error.

ORA-29279: SMTP permanent error: 503 5.5.2 Send hello first [LO4P123CA0158.GBRP123.PROD.OUTLOOK.COM]

Below is my code.

  l_mail_conn := UTL_SMTP.open_connection(host, '587');
  utl_smtp.starttls(l_mail_conn);
  
  UTL_SMTP.AUTH(l_mail_conn, msg_from, password, schemes => 'PLAIN');
  UTL_SMTP.mail(l_mail_conn, msg_from);
  UTL_SMTP.rcpt(l_mail_conn, msg_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, 'To: ' || msg_to || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'From: ' || msg_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || 'Test Email' || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || msg_to || UTL_TCP.crlf || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Sent using UTL_SMTP' || UTL_TCP.crlf || UTL_TCP.crlf);

  UTL_smtp.close_data(l_mail_conn);
  UTL_SMTP.quit(l_mail_conn);

TIA

William Robertson
  • 15,273
  • 4
  • 38
  • 44
  • SMPT 503: https://stackoverflow.com/questions/1865331/email-error-503-how-to-solve Network Access Control List setup: https://stackoverflow.com/questions/53835269/acl-error-when-trying-to-send-mail-via-oracle-utl-smtp, if that helps. This is more of a DBA question. – William Robertson Jul 11 '22 at 19:33
  • Hi William, Thanks for the update. I have already done ACL steps and facing this error. – Kushal Shah Jul 12 '22 at 08:52
  • could you solve it? I have the same error, thanks. – Tom Jan 20 '23 at 17:27

0 Answers0