Skip to Main Content


Question and Answer

Connor McDonald

Thanks for the question, David.

Asked: May 22, 2023 - 9:02 pm UTC

Last updated: May 23, 2023 - 4:44 am UTC

Version: Oracle Database 11g Release

Viewed 100+ times

You Asked

We have been using an older version of Apex for about 10 years now and now want to set up email capability for sending reports as attachments. I have scoured the internet for the requirements to use but am getting confused with all the different answers. We need to connect to an external smtp server. What exactly do I need to get in place to get this to work on this older version of Apex? Please let me know if you need more info to better answer this question. Thank you.

and Connor said...

APEX 4 ? wow :-)

Easiest way would be to install UTL_MAIL and use that.

conn sys/password as sysdba

conn sys/password as sysdba
alter system set smtp_out_server='' scope=spfile;

-- instance restart only necessary in 10gr1.
shutdown immediate

  utl_mail.send_attach_varchar2 (
    sender       => '',
    recipients   => ',',
    cc           => '',
    bcc          => '',
    subject      => 'This is the subject',
    message      => 'This is the message',
    attachment   => 'This is the text attachment.',
    att_filename => 'filename.txt'    

but come on ... its time to upgrade!

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