Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, ANURAG.

Asked: February 15, 2018 - 8:07 am UTC

Last updated: February 15, 2018 - 11:03 am UTC

Version: 11.2.0.3.0

Viewed 1000+ times

You Asked

Hi Tom,

I am not too sure whether this question has been asked earlier or not but here it goes,

I have a setup where pl/sql is code is generating reports on a daily , monthly basis, all
the reports are in .csv format, the reports generated are sent to the respective people both
internal and external to my organization,the emails are maintained in a .csv file maintained by the users,
the .csv file contains the to, cc and bcc email ids, once in a while someone whose email is configured in
.csv file leaves the organization and the user forgets to update the .csv file now when my pl/sql code
runs to send the report to that particular user list it throws the below error:

ORA-29279: SMTP permanent error: 550 5.0.0 ..... User unknown

Now when this error comes, the file is not sent to the other correct users mentioned in the cc or bcc considering the above user mentioned in 'to email' has left the organization, is there a way in oracle where I can skip the incorrect email Id and the report is sent to the correct emails mentioned in the cc and bcc list ?

and Chris said...

The problem is to find out if an address is valid you need to send an email to it! So you don't know in advance which to skip.

There's a couple of options you could look at here:

1. Ensure each email has exactly one recipient. When you get this (or any other) SMTP error, catch the exception, log it, and move onto the next address.

2. The error comes from the mail server. Speak with admin of this to see if they can change its configuration to stop this error occurring.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library