Using PL/SQL UTL_SMTP package to send email with error: 501 5.1.3
citicbjMar 20 2013 — edited Mar 21 2013I have a procedure html_email to send email notification message in text and html formated to a group of users. This procedure is called by another procedure (called procedure A) for execution. In procedure A, if I set feed p_to parameter with cursor loop, it will return error message like this:
----In Procedure A
My cursor is like this:
CURSOR cur_notify IS
SELECT DISTINCT EMAIL FROM notification_table;
For rec_notify in cur_notify Loop
l_to := rec_notify.EMAIL;
html_email (l_to, l_from, l_subject, 'none', l_body);
END LOOP;
Then email will be sent with error message from EXCEPTION like this:
my_email_notification procedure Failed on DEVSERVER at 20-MAR-13.
Error:
ORA-29279: SMTP permanent error: 501 5.1.3 Invalid address
ORA-06512: at "SYS.UTL_SMTP", line 29
ORA-06512: at "SYS.UTL_SMTP", line 110
ORA-06512: at "SYS.UTL_SMTP", line 252
ORA-06512: at "SCHEMA1.HTML_EMAIL", line 26
ORA-06512: at "MY_EMAIL_NOTIFICATION", line 174
I think this may be caused by a list of email address from loop. So I change the code like this:
For rec_notify in cur_notify Loop
l_to := 'my_email@company.com;
html_email (l_to, l_from, l_subject, 'none', l_body);
END LOOP;
At this time, email will be sent fine. How can I resolve this 501 5.1.3 Invalid address problem? Should I work on PL/SQL code or work on email server configuration? I cannot reach
to email server. So how can I work on procedure to fix this? Thanks for your input.