Search This Blog

Tuesday, July 8, 2025

How Do I Configure Email in Autonomous Database with OCI Email Delivery

 

Introduction
Configuring email in Oracle APEX running on an Autonomous Database with OCI Email Delivery allows your applications to send reliable and secure emails using Oracle Cloud Infrastructure’s managed SMTP service. This setup supports sending notifications, confirmations, and system alerts while meeting modern authentication and security standards. It requires setting up an approved sender, generating SMTP credentials, and connecting your APEX environment to OCI Email Delivery through proper SMTP configuration.

 
  1. Identify the SMTP Endpoint

    • The SMTP host address must be obtained from OCI Email Delivery settings.

  2. Generate SMTP Credentials

    • SMTP credentials are needed to authenticate email requests.

  3. Create an Approved Sender

    • Only approved sender email addresses can be used in APEX.

  4. Set SMTP Parameters in APEX

  • Use the APEX_INSTANCE_ADMIN.SET_PARAMETER procedure to configure SMTP settings. 
 To configure email in Oracle APEX running on Autonomous Database (ADB) with Oracle Cloud Infrastructure (OCI) Email Delivery, you must integrate APEX with OCI’s secure SMTP relay. This allows your APEX application to send transactional and notification emails using Oracle’s managed email infrastructure, which supports SPF, DKIM, and secure SMTP authentication. The setup includes configuring OCI Email Delivery, creating SMTP credentials, and updating the APEX environment.

Here’s a detailed step-by-step guide:

  1. Prerequisites

    • You must have an Oracle Cloud account with appropriate permissions.

    • Your APEX environment must run on Autonomous Database (Shared or Dedicated).

    • An approved OCI Email Delivery sender must be registered.

  2. Create an Approved Sender in OCI Email Delivery

    • Sign in to the OCI Console.

    • Go to Email Delivery > Approved Senders.

    • Click Create Approved Sender and enter an email address (e.g., noreply@yourdomain.com).

    • The sender must be verified if your domain has domain protection enabled (DKIM/SPF records).

    • Wait for the sender to be approved.

  3. Generate SMTP Credentials

    • In the OCI Console, go to Identity > Users.

    • Select the user who will send emails (or create a service user for email).

    • Click SMTP Credentials > Generate SMTP Credentials.

    • Save the generated username and password — these will be used in APEX to authenticate.

  4. Locate the OCI SMTP Server Details
    Use these values in your APEX email configuration:

    • SMTP Host: smtp.email.us-ashburn-1.oci.oraclecloud.com (or region-specific endpoint)

    • SMTP Port: 587 (STARTTLS) or 465 (SSL)

    • Username: The generated OCI SMTP username

    • Password: The generated OCI SMTP password

  5. Configure Email in APEX on Autonomous Database

    • Log in to your APEX workspace using the ADMIN account.

    • Go to Manage Instance > Instance Settings > Email.

    • Enter:

      • SMTP Host Address: Use the OCI SMTP hostname.

      • SMTP Port: 587

      • Username and Password: Use the generated SMTP credentials

      • Use SSL/TLS: Enabled (typically STARTTLS with port 587)

      • Sender Address: Must match your approved sender (e.g., noreply@yourdomain.com)

    • Click Apply Changes.

  6. Test the Email Configuration in APEX
    You can send a test email using PL/SQL in SQL Workshop or as a page process:

    BEGIN
      APEX_MAIL.SEND(
        p_to        => 'yourtestemail@example.com',
        p_from      => 'noreply@yourdomain.com',
        p_subj      => 'Test Email from APEX with OCI Email Delivery',
        p_body      => 'This is a plain text test email.',
        p_body_html => '<p>This is a <strong>test email</strong> using OCI Email Delivery.</p>'
      );
      APEX_MAIL.PUSH_QUEUE;
    END;
    
  7. Verify Delivery

    • Monitor delivery by checking your test inbox.

    • Use the APEX_MAIL_LOG view to inspect email status:

    SELECT * FROM APEX_MAIL_LOG ORDER BY SENT_DATE DESC;
    
    • For pending messages, check:

    SELECT * FROM APEX_MAIL_QUEUE;
    
  8. Best Practices

    • Use the same From address as your approved sender.

    • Avoid sending test emails to external users in development.

    • Configure your domain’s SPF and DKIM records to allow OCI as a sender for your domain.

    • Monitor usage from the OCI Console to stay within quota and compliance limits.

By completing this configuration, your APEX apps running on Autonomous Database will be able to send emails securely through OCI’s robust delivery infrastructure, supporting reliable communication, compliance, and high deliverability.

Conclusion
By integrating OCI Email Delivery with Oracle APEX on Autonomous Database, you enable trusted and secure email communication directly from your application. With the approved sender and SMTP credentials in place, APEX can send dynamic, user-friendly emails that enhance user experience and operational efficiency—while staying compliant with cloud security practices.

No comments:

Post a Comment

HOW DO I SET A HOME PAGE

 Setting a home page in Oracle APEX is an essential step in defining the default landing page for your application. The home page serves as ...