Oracle Apex Thoughts.: How to send an email from apex 4.2 and 11g XE - 0 views
-
cezarovidiu on 30 Sep 14"How to send an email from apex 4.2 and 11g XE To accomplish sending an email from your Oracle Apex application using oracle database 11g r2, you must use the new DBMS_NETWORK_ACL_ADMIN package to grant connect privileges to any host for the APEX_040200 database user. To start things off, begin by installing a free mail server emulator in your development environment. I used Melon 1.0 that can be downloaded from http://www.softpedia.com/get/Internet/Servers/E-mail-Servers/Viktor-Melon.shtml. After unpacking the archive just place the folder anywhere in your file system. The sample mails sent will be stored in the .Melon sub directory. Secondly connect to the database as sys user and run the following script: DECLARE ACL_PATH VARCHAR2(4000); BEGIN -- Look for the ACL currently assigned to 'localhost' and give APEX_040200 -- the "connect" privilege if APEX_040200 does not have the privilege yet. SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS WHERE HOST = 'localhost' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL; IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040200', 'connect') IS NULL THEN DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH, 'APEX_040200', TRUE, 'connect'); END IF; EXCEPTION -- When no ACL has been assigned to 'localhost'. WHEN NO_DATA_FOUND THEN DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('local-access-users.xml', 'ACL that lets users to connect to localhost', 'APEX_040200', TRUE, 'connect'); dbms_network_acl_admin.assign_acl('local-access-users.xml','localhost'); end; The third step is to set the smtp settings in Apex. 1. Log in to Oracle Application Express Administration Services. If your setup uses the embedded PL/SQL gateway, go to: http://hostname:port/apex/apex_admin 2. Click Manage Instance. 3. Under Instance Settings, click Instance Settings. 4. Under Email, enter the following: 1. SMTP Host Address - Defines the server