ggkmath
ggkmath

Reputation: 4246

Oracle Database: possible to send email from PL/SQL through proxy server?

I find a lot of details on the internet how to configure Oracle database to use PL/SQL commands to send an email from the database, but they're all using the SMTP server that the database is installed in (I think at least). If these emails are being sent to DBAs, then that's fine.

What about the scenario where an email is sent to customers? In this case wouldn't we want the email to be sent from an application server (e.g. DMZ), and NOT the database server?

I'm assuming the IP address of the database server (or other special information regarding the database server that we'd rather keep private) would be available in such an email. If this isn't true, my question has no merit.

Is it possible to generate an email from the database PL/SQL command(s) but have it sent to the customer from a proxy (e.g. application) server? So the email traffic route would be: database server --> application server --> customer. The added benefit is most email systems would be on the application server anyway so returned emails would go the application server.

Upvotes: 2

Views: 2055

Answers (2)

DCookie
DCookie

Reputation: 43533

They're not necessarily using the SMTP server that the "database is installed in" (not really sure what you mean by that). You define the system parameter SMTP_OUT_SERVER to configure the IP and port of the SMTP server. Oracle will send email to whatever server you define, as long as it is network accessible.

See this site for more information on setting up UTL_MAIL. Try it out. Look at the headers. See for yourself what it looks like.

Upvotes: 3

Jeffrey Kemp
Jeffrey Kemp

Reputation: 60312

If you're using UTL_SMTP, your code will have a line like this somewhere:

c := UTL_SMTP.open_connection( 'myhost', 25 );

The first parameter is the mail server. You should be able to set it to any server that your database server can connect to (via port 25).

Upvotes: 4

Related Questions