Sending Emails from OCI with Email Delivery Service in Node.js

Oracle Cloud Infrastructure Email Delivery is an email sending service that provides a fast and reliable managed solution for sending high-volume emails that need to reach your recipients’ inbox. Email Delivery provides the tools necessary to send application-generated email for mission-critical communications such as receipts, fraud detection alerts, multi-factor identity verification, and password resets.

Go to a IAM/user and click on [Generate SMTP Credentials] as shown below:

Keep the credentials created in a safe place:

Create an Approved Sender (a real existing email account to put in the from field):

Grab the connection details:

Now test the code:

npm install [nodemailer](

Create a sendmail.js file:

var nodemailer = require('nodemailer');
async function main() {
let testAccount = await nodemailer.createTestAccount();
let transporter = nodemailer.createTransport({
  host: "",
  port: 25,
  secure: false,
  auth: {
    user: '', 
    pass: 'BD..._', 
let info = await transporter.sendMail({
  from: '"', 
  to: "", 
  subject: "ssh access to",
  html: "<b>ssh -i deltakey -o ProxyCommand=\"ssh -i deltakey -W %h:%p -p 22\" -p 22 opc@</b>", 
console.log("Message sent: %s", info.messageId);
console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));

Test it:

node sendmail.js

That’s all, hope it helps! 🙂

If you’re curious about the goings-on of Oracle Developers in their natural habitat, come join us on our public Slack channel!

And don’t forget our free tier, where you can try out what we just discussed.