Oracle Cloud Infrastructure (OCI) Email Delivery is a robust email-sending service that utilizes Simple Mail Transfer Protocol (SMTP) relay to deliver fast and reliable solutions for high-volume bulk and transactional emails. In this blog post, I will walk you through the detailed process of sending emails with Email Delivery.
Pre-Requisites
To start using Oracle Cloud Infrastructure (OCI) Email Delivery, you need to create a group and a user with appropriate permissions and generate SMTP credentials for the user. Here’s how to do it:
- Create a group dedicated to SMTP users. Open the navigation menu and click on Identity & Security. Under Identity, select Groups, and click Create Group. Give the SMTP group a name. I created the group “abkot-smtp-grp“.
- Create an SMTP user and add it to the SMTP group. Under Identity, select Users, and click Create User. Give the user a name. I create the user “abkot-smtp-usr“. On the User Details page, scroll down to the Groups section, and click Add to Group. Select the SMTP group you just created.
- Set up permissions for the SMTP group using policies. Under Identity, select Policies, and click Create Policy. Give the policy a name and description. I gave policy names as “abkot-smtp-pol” and descriptions as “Policy for Email Delivery“. In the policy statements section, add the following statements:
- Allow group abkot-smtp-grp to use email-family in compartment hub-cmp
- Allow group abkot-smtp-grp to manage credentials in compartment hub-cmp where target.credential.type = ‘smtp’
- Allow group abkot-smtp-grp to manage email-family in compartment hub-cmp
- Allow group abkot-smtp-grp to manage suppressions in tenancy
- Allow group abkot-smtp-grp to manage log-groups in compartment hub-cmp
- Allow group abkot-smtp-grp to read log-content in compartment hub-cmp
- Generate SMTP credentials for the user. Go back to the Users page, and click on the SMTP user. Select SMTP Credentials, and click Generate SMTP Credentials. Give a description, and click Generate SMTP Credentials. A username and password will be displayed. Copy them for your records, as the password cannot be retrieved after closing the dialogue box.
Create Email Domain
To create an email domain in Oracle Cloud Infrastructure (OCI) Email Delivery, follow these steps:
- Open the navigation menu and click on “Developer Services“. Under “Application Integration“, click “Email Delivery“. From the Email Delivery menu, select “Email Domains“.
- Click on “Create Email Domain“.
- Enter your email domain name in the field provided. For example, “abkot.com“. Make sure that this is a domain you own or control in DNS, as verification and authentication measures require a DNS record update or similar actions.
- Click on “Create“.
You can also enable Outbound Accepted and Outbound Relayed logs by clicking on “Logs” on the Email Domains Detail page.
Next, you need to configure Domain Keys Identified Mail (DKIM) to verify that an email is sent and authorized by the owner of the sender’s domain. To do this, go to the Email Domain Details page and click on “Add DKIM“. Enter a unique selector for the DKIM key, such as “prefix-region-YYYYMMDD” (recommended by Oracle). Click on “Generate DKIM Record” to generate the DKIM record, then click on “Done“.
Copy the system-generated CNAME record and value. You’ll need to copy this information for your DNS setup.
Finally, verify the DKIM configuration under the Email Domain Details page.
Create Approved Sender
To add an email address to your list of approved senders, go to the Email Domains Details page and click on the “Approved Senders” link. Next, click on “Create Approved Sender” and enter the email address you want to add in the “Add Sender” dialogue box. Then click on “Add” and the email address will be added to your Approved Senders list.
If you need to obtain the SMTP configuration, you can navigate to the Developer Services section and click on “Email Delivery” under “Application Integration“. From there, click on “Configuration” in the Resources menu. You will see the following information displayed:
- Public Endpoint: This is the public endpoint that should be used to send emails to the region you are in.
- SMTP Ports: These are the SMTP ports that are used to accept email. Email Delivery supports TLS on port 25 or 587.
- Security: This field indicates whether TLS is being used for encryption in transit of the email, which is the standard means of performing this function.