Sending emails using an APEX application- part 1

This article summaries the steps taken to configure APEX application to send emails.

We shall use the email delivery service from Oracle Cloud.

New to Oracle cloud? Get a free trial version of Oracle cloud here.

The assumption is that you have already configured your IAM policies correctly ie. the user we use is in a group (ie. MailGroup ) which has a policy passed to manage approved mail senders.

Allow group MailGroup to manage approved-senders in compartment CompartmentA /tenancy etc.

Learn more about Oracle Email delivery policies here.

Let’s now set up the user SMTP credentials.

To generate SMTP credentials of the user to use in our email delivery, navigate to the user’s profile on Oracle Cloud -> Identity -> Users -> select your user.

On the left side click SMTP Credentials -> Click on generate credentials.

Save the username and password generated. You shall use them later on configuring your APEX application.

Add the user on the Email approved Senders’ List of Oracle Email Delivery.

Navigate to your cloud console to Email Delivery -> Email Approved senders- > create approved sender. (add the user)

Next click on the Email configuration to get the SMTP connection endpoint. (Save it for later use)

ie. smtp.email.eu-frankfurt-1.oci.oraclecloud.com

Set Email Parameters on the Database

Connect to your Database as ADMIN and execute the PL/SQL script below. If you are using Autonomous database, you can connect to your DB using SQL Developer Web.

BEGIN
APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_HOST_ADDRESS', 'Your SMTP connection endpoint ie. smtp.email.eu-frankfurt-1.oci.oraclecloud.com');
APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_USERNAME', 'smtp username generated');
APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_PASSWORD', 'smtp password generated');
COMMIT;
END;
/

Send Email from APEX

Now login to APEX and navigate to SQL workshop to run this command.

BEGIN
apex_mail.send(p_from => 'your approved email sender',
p_to => 'ncve3@gmail.com',
p_subj => 'Email from Autonomous',
p_body => 'It worked!!');
apex_mail.push_queue();
END;
/

Once you run that PL/SQL an email is sent to your client!

Monitoring

You can monitor the mail logs using these commands or using your APEX admin dashboard (Monitor activity\ Mail Log).

Select * from apex_mail_log;

SELECT * FROM APEX_MAIL_QUEUE;

Next

We shall use the now configured email functionality to send emails from APEX application process.

References

Sending Emails from APEX by Sinan

Sending Emails from your APEX by Chaitanya Koratamaddi

A multi cloud strategy in cloud adoption

Cloud computing is the convenient model of computing where users can access from anywhere a shared pool of resources and pay only for what they consume.

It has been largely adopted by majority of the startups , SMEs (Small and Medium-sized Enterprises), and large enterprise businesses. Among the reasons being that it makes the businesses to focus on the core of their business as the cloud provider offers a scalable, reliable and on demand infrastructure, platform or software service.

Multi cloud strategy is the newly adopted trend where businesses are involving more than one cloud vendor to support their business. This should not be confused with hybrid computing.

Hybrid computing refers to when a business runs some of it’s workloads on premise and other on a public or private cloud with a secured connection between the two. Multi cloud on the other hand refers to when a business involves different cloud providers to run it’s workloads.

Some of the benefits of a Multi Cloud Strategy include:

  • Avoiding Vendor lock in – Some enterprises are afraid of being locked into a single vendor- thus with the multi cloud strategy they are not “dependent” on a single cloud provider.
  • Redundancy and Performance – Every enterprise wants to have a continual up time and performance to beat their competition. This makes them approach multi cloud strategy to support their strategy.
  • Data sovereignty /Compliance – Due to different regulations, some enterprises are forced to adopt certain cloud vendors within their regions or within the stipulated regulations regarding data .

However, a multi cloud strategy comes at cost such as you require a large talent pool to handle the various technologies from the various vendors, this can also lead to management complexity.

Some cloud vendors have already adopted the multi cloud model.

Oracle Cloud and Microsoft Azure cloud have a interoperability partnership allowing customers to run mission critical enterprise workloads across both clouds.

Google embraces the mult cloud strategy with Anthos, an open application modernization platform.

As an enterprise, you need to evaluate your current status on the digital transformation journey, where you are today and where you target to be, then choose wisely a cloud strategy that shall offer you a high ROI.

Laban.

Today, the greatest concern on many enterprise IT infrastructures is manageability, reliability , availability, performance, security, scalability just to list a few.

If a multi cloud strategy solves the above challenges for you, then it’s time you take the leap.

References:

Tech Target

ZD Net

Oracle News

Google News

Bash commands you can never live without!

This is more of a generic post. I am posting some of the Bash/Linux/Windows commands i find useful everyday!

Source Control :Git

When you want to push your local project to GitHub, create a repository (Don’t add a Readme file yet) on GitHub.

On your local workstation, fire the bash utility in the root folder of your project on your windows file system.

On the Git Bash, run:

git init
git remote add origin https:// (link to your online repository)
git remote -v (Just to confirm your remote repo)
echo 'node_modules'>>.gitignore (Files you want to ignore to pushing to GitHub)
git add .
git commit -m "First commit"
git push origin master

A times you may have commit issues due to file conflicts:

Open the conflicting file -edit and merge the head accordingly. Then;

git add filename
git commit -m "merged file A and B"git push origin master

Other commands:

Ngrok: (helps you expose your localhost to public internet)

http localhost:<port>  (Windows, where port is your port number)

./ngrok http <port> (Linux, where port is your port number)

In Oracle compute, you might want to run a “screen” command to run the ngrok  on detached mode:

screen-S <name of the new screen> This opens a new Screen.

Deploy ngrok on this screen. When done press Ctrl +A+ D to exit.

To confirm the the screen got created:

screen -ls  (shows you all the screens and their ids named "Detached")

To re-access the screen:

screen -r <screen_ID>

To quit:

screen -X -S <screen_id> quit

What other commands do you use daily… but you keep forgetting?

Happy coding! Keep Innovating!