– In case a following Oracle error, go to next step and enable ACL in Oracle 11g database: Not allow it to contact an external SMTP server. Is not with the UTL_SMTP package but the fact that your database server’s network configuration does The “ORA-29278: SMTP transient error: 421 Service not available” error indicates that the problem ORA-29278: SMTP transient error: 421 Service not available – In case of following ORA- error go to step 2 and 3: this should send an email from a dummy account to your email addressĮxecute testmail Subject','Test Body Text',25) WHEN UTL_ansient_error OR UTL_smtp.permanent_error THEN UTL_smtp.write_data(objConnection,UTL_tcp.CRLF||''||body||'') UTL_smtp.write_data(objConnection,UTL_tcp.CRLF||'') UTL_smtp.write_data(objConnection,UTL_tcp.CRLF||'') UTL_smtp.write_data(objConnection,UTL_tcp.CRLF) UTL_smtp.write_data(objConnection, 'Content-Transfer-Encoding: ' || '"8Bit"' || UTL_smtp.write_data(objConnection, 'Content-Type: ' || 'text/html ')
UTL_smtp.write_data(objConnection, 'MIME-Version: ' || '1.0' || UTL_tcp.CRLF) UTL_smtp.write_data(objConnection, 'Subject: ' || sub || UTL_tcp.CRLF)
UTL_smtp.write_data(objConnection, 'From: '||fromm || UTL_tcp.CRLF) ObjConnection := UTL_smtp.open_connection('',port) (fromm varchar2,too varchar2,sub varchar2,body varchar2,port number) Place twice in the below procedure your actual smtp_server name Sending email from Oracle database via SMTP If not, you can send an email from a dummy email account. Note that the mail server can check if the sender email exists. This will enable the SMTP server sending emails on behalf of the sender (your Oracle database Linux box). Outgoing email: emails per month: around 50-100Īfter that your mail admins will add a sender IP address to a corporate SMTP mail server to allow the sender Linux server access the SMTP server. Please allow SMTP traffic at for the following new server: Rcpt to: # you should see "Recipient OK"Ĭontact your mail (exchange) admins and apply for SMTP access on your corporate smtp mail gateway server. Otherwise type the following commands to test sending email from Linux to your corporate email account: In this case you have to apply for mail SMTP access. Your DB server is not recognized by the SMTP server. If you see blank screen or an error: “telnet: Unable to connect to remote host: Connection refused”, – Check whether you are able to contact the email gateway server via SMTP from the database Linux box: $ telnet smtp_server 25
Check SMTP access of database Linux server on mail server Oracle packages SYS.UTL_SMTP and SYS.UTL_TCPĬheck if Oracle packages SYS.UTL_SMTP and SYS.UTL_TCP are available on Oracle database and you have EXECUTE grants on them. My test example includes an Oracle database 11gR2 running on Linux RedHat 6 and a Microsoft Exchange corporate server. Below I give a detail action plan to accomplish the same. Imagine you have to provide your database applications an ability to send emails via Simple Mail Transfer Protocol (SMTP) protocol from Oracle database. Often in a complex enterprise Infrastructure Oracle DBAs face issues by enabling SMTP mail traffic on the databases through corporate email gateway servers.