Skip to main content

Command Palette

Search for a command to run...

Send Mail from Free-Tier

Updated
2 min read
Send Mail from Free-Tier
T

Databaseguy, Oracle Apex Lover

Configuration Steps
See here:
https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/apex-send-email.html
And here:
Sending Email from your Oracle APEX App on Autonomous Database

  1. In Oracle Cloud https://cloud.oracle.com/identity/users/

Add SMTP Credentials:

  1. copy username and password into

connect as ADMIN to the database

BEGIN
    APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_HOST_ADDRESS', 'smtp.email.eu-frankfurt-1.oci.oraclecloud.com');
    APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_USERNAME', 'ocid1.user.oc1..xxxx@ocid1.tenancy.oc1..xxxx.gm.com');
    APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_PASSWORD', 'H90uUK+xxxxxxx;');
    COMMIT;
END;
/

And then test it:


BEGIN
    APEX_INSTANCE_ADMIN.VALIDATE_EMAIL_CONFIG;
END;
/

=> no errors => no problems ;-)

But... dont use @gmail adresses

Try to send email


declare 
  l_workspace_id number;
BEGIN
    l_workspace_id := apex_util.find_security_group_id('YOURWKSPNAME');
    apex_util.set_security_group_id(l_workspace_id);

    APEX_MAIL.SEND(p_from => 'irgendwas@mustermann.at',
                   p_to   => 'txsaxxaas@gmail.com',
                   p_subj => '2 from Oracle Database',
                   p_body => 'Sent using APEX_MAIL');
   apex_mail.push_queue(); 
END;
/

nothing happens - also no entires in apex mail queue



select * from APEX_MAIL_QUEUE;
rows found

select * from APEX_MAIL_LOG;
no rows found

.. investigation

Has the user email approved been entered?

I see in the Email Approved Senders that I haven't defined an SPF.

As I am registered with Cloudpit, I need to create a TXT entry for my domain here. So, I'll try using this setting:

What does Oracle say now?

no SPF found.. maybe i have too wait a little..

But i will retry sending an email.. and now:

ohohoh.. Email arrived ...

yess..

One Year Later add a new domain:

Email Delivery | Oracle Cloud Infrastructure

lms.liebermitsinn.at.dkim.fra1.oracleemaildelivery.com

lms._domainkey.liebermitsinn.at.

Webhosting & Domains - CloudPit (easyname.com)

CNAME Eintrag hinzufügen

Status:

T

Hi, i never used oauth2 at the moment. Please connect to Jeff Smith or one of the apex team. They will answer normally immediate. Try on X or bluesky

M

Hello I really thank you! very useful and perfect explained info, I was able to send emails But now I am exploring a topic related to Oracle APEX and Microsoft Exchange Online, Microsoft is requesting to upgrade to using oAuth2 this 2025, have you ever been asked to upgrade to oAuth2 on an instance that uses Microsoft Exchange Online for sending e-mail? If not, do you think it is possible to configure Microsoft Exchange Online with oAuth2 using Ords? I you can help me with this question I think it will be very complicated but I don't know How to start facing the challenge