Welcome to OCI.
Today we are going through the steps to configure Email Delivery in OCI.
We are also going to send a test email to verify the configuration.
Before you begin, ensure that your user has been assigned to a group with permissions to
manage the “email-family” resources. Please see the description for the
permission set up documentation link. Finally, you need a DNS domain to publish
your domain keys identified mail aka (DKIM) and sender policy framework aka (SPF) records.
For this demo, I have used a Linux Compute instance.
The first step is to create an email domain. To do this:
Go to Developer Services > Application Integration > Email Delivery.
Click Email Domains, and then Create Email Domain.
Enter a name for your email domain. This should be a domain you own or control in DNS.
Click Create. At this point you will see a warning in the DNS status.
Click Add DKIM. Enter a DKIM Selector name and
then click Generate DKIM Record. At this point, you may want to save
the CNAME Record and Value in a notepad. You will need it when you configure your DNS Zone.
Click Create DKIM. Next, click Approved
Senders > Create Approved Senders. Add an email address and submit.
Now, you can go ahead and create the DNS zone.
Go to Networking > DNS Management > Zones > Public Zone, and click Create Public Zone.
Enter a Zone Name, ensure that you have selected the correct compartment, and then click Create.
Under Resources > Records, click Add Record. In Record Type, select CNAME.
Remember we saved the CNAME record and value of the DKIM that we created
for the email domain a minute ago? In the Name field enter the CNAME
Record and in the Target field, enter the CNAME Value of the DKIM.
Click Submit and Publish Changes. Similarly, add a record for the Record Type
“A” and in Target, enter the IP address of the instance from which you want to send the email.
Click Submit. Next to configure
the SPF of your email domain in your DNS zone, therefore go to Email Domain > Approved Sender,
click the three-dot menu, and click View SPF. Copy the SPF record you want.
For this demo, I am using the All Commercial region option.
After this, come to the DNS zone that you created, and add a TXT record.
In the Text field, paste the SPF record. Submit and publish the changes.
At this point your DKIM Selector in the Email Domain should be successfully configured.
Finally, you need to create SMTP credentials.
Go to Profile > User Settings. Under Resources, click SMTP Credential.
Click Generate SMTP Credential, enter a description, and submit.
Copy the user name and password for your record and click Close.
We are all set now. So, let’s try to send an email to test it out.
Please note that you can use your own SMTP library or product to send an email.
For this tutorial, I am using a Python script. Check the description for the Integrating
Python with Email Delivery documentation. In the instance which you used in the DNS zone,
create a Python file to send a test email. Please see the video description for the script. Also,
in the same directory, create a “.config” file and save your SMTP credentials.
SENDER is the email id of the approved sender that we added to the email domain.
RECEPIENT is the email id to which I want to send the test email.
Enter your HOST and PORT is 587.
Make sure that the Security List of your VCN has port 587 enabled in it.
Enter a subject and a body text for your test email.
Now, run the command as shown. The email is successfully sent.
Check your inbox for the test email. This is how you configure email delivery is OCI.
Thanks for watching. Please contact OCI Support if you still need assistance.